From fb353ce54efc3abf3c2ba7795d0c9bf7aed6df96 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 18 Oct 2017 08:03:14 -0400 Subject: CSIT-844: fix binary api rx pthread heap push/pop We need to push/pop the rx pthread's heap without affecting other thread(s). Search clib_per_cpu_mheaps, locate an unused slot. Duplicate the main thread heap pointer in that slot, and set __os_thread_index appropriately. Don't bail out of vpp_api_test with results pending, e.g. at the end of a vpp_api_test script. Even though vpp will eventuallly garbage-collect them, We don't want to leave allocated reply messages lurking in the api message allocation rings... This patch is a manual cherry-pick from gerrit 8862 Change-Id: If3c84abe61496905432bfa36767068bad4bd243b Signed-off-by: Dave Barach --- src/vat/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/vat/main.c') diff --git a/src/vat/main.c b/src/vat/main.c index 1bad2ebb..b8856cc9 100644 --- a/src/vat/main.c +++ b/src/vat/main.c @@ -297,6 +297,7 @@ main (int argc, char **argv) u8 *heap; mheap_t *h; int i; + f64 timeout; clib_mem_init (0, 128 << 20); @@ -408,6 +409,18 @@ main (int argc, char **argv) fclose (vam->ifp); } + /* + * Particularly when running a script, don't be in a hurry to leave. + * A reply message queued to this process will end up constipating + * the allocation rings. + */ + timeout = vat_time_now (vam) + 2.0; + while (vam->result_ready == 0 && vat_time_now (vam) < timeout) + ; + + if (vat_time_now (vam) > timeout) + clib_warning ("BUG: message reply spin-wait timeout"); + vl_client_disconnect_from_vlib (); exit (0); } -- cgit 1.2.3-korg