session: make sure fifos are freed on right thread
[vpp.git] / src / vnet / session / segment_manager.c
index e72e833..14e4e21 100644 (file)
@@ -856,6 +856,10 @@ segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo)
   if (!rx_fifo || !tx_fifo)
     return;
 
+  /* Thread that allocated the fifos must be the one to clean them up */
+  ASSERT (rx_fifo->master_thread_index == vlib_get_thread_index () ||
+         rx_fifo->refcnt > 1);
+
   /* It's possible to have no segment manager if the session was removed
    * as result of a detach. */
   if (!(sm = segment_manager_get_if_valid (rx_fifo->segment_manager)))