aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-10-18 08:03:14 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-10-18 22:24:22 +0000
commitfb353ce54efc3abf3c2ba7795d0c9bf7aed6df96 (patch)
tree3dcb4b8967dee2ab8adbfedf1a77c23c3b17fa66 /src/vat
parent7513c8c7d2ed702f346fd707eb2b76fce8657c1d (diff)
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 <dave@barachs.net>
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vat/main.c b/src/vat/main.c
index 1bad2ebb14d..b8856cc9fa3 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);
}