aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c2
-rw-r--r--src/vat/main.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 24b6fb06a3a..d6af6984467 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -5884,7 +5884,7 @@ exec_inband (vat_main_t * vam)
W (ret);
/* json responses may or may not include a useful reply... */
if (vec_len (vam->cmd_reply))
- print (vam->ofp, (char *) (vam->cmd_reply));
+ print (vam->ofp, "%v", (char *) (vam->cmd_reply));
return ret;
}
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);
}