The ibv reader was crashing due to use-after-free errors. It needed to call ibv_end_poll after the batch finished, but if a packet in the batch stopped the stream, the reader would immediately get destroyed, taking the completion queue with it.
Fix by delaying the actual stream stop until the add_packet_state object is destroyed, which gives the poller object a chance to unwind first.
The ibv reader was crashing due to use-after-free errors. It needed to call ibv_end_poll after the batch finished, but if a packet in the batch stopped the stream, the reader would immediately get destroyed, taking the completion queue with it.
Fix by delaying the actual stream stop until the add_packet_state object is destroyed, which gives the poller object a chance to unwind first.