summaryrefslogtreecommitdiffstats
path: root/src/vat/main.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-10-17 11:48:29 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-10-18 11:47:29 +0000
commitcf5e848d69a4f14464c1e2d56896bc9f7e586951 (patch)
treecc74c2ba457b03a7dc75fabb1b1304e3e47342f0 /src/vat/main.c
parent965fec9089de96c2afbffc3dec3360d043e3eead (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. Miscellaneous cleanups. Print exec_inband results as a vector, instead of as a format string. 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... Change-Id: I0e8a25d1ff0d3700249dc330d079db16c2fcbc55 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vat/main.c')
-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 e2c9b70889a..aa990a31d93 100644
--- a/src/vat/main.c
+++ b/src/vat/main.c
@@ -308,6 +308,7 @@ main (int argc, char **argv)
u8 *heap;
mheap_t *h;
int i;
+ f64 timeout;
clib_mem_init (0, 128 << 20);
@@ -432,6 +433,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);
}