CQ events have to be acked prior to CQ destruction. Otherwise, CQ destruction will wait indefinitely for those events to be acked. In Python it's possible for a simple syntax error to cause a runtime error which leads to teardown of all objects. For CQ, this can mean a destruction without acking CQ events. To avoid that, keep track of the number of events and during teardown, if there are events that weren't acked, do so implicitly. The first patch adds this support. The second one adds a simple traffic test that uses CQ events mechanism rather than poll. Noa Osherovich (2): pyverbs: Handle CQ events properly tests: Add a test for completion events pyverbs/cq.pxd | 2 ++ pyverbs/cq.pyx | 14 ++++++++++++- tests/CMakeLists.txt | 1 + tests/test_cq_events.py | 45 +++++++++++++++++++++++++++++++++++++++++ tests/utils.py | 11 +++++++--- 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 tests/test_cq_events.py -- 2.21.0