Problem: intermittent deadlocks/timeouts in test_monitor and test_security_zap

Solution: wait for monitor to stop resp. unregister monitor before
closing monitored socket.
This commit is contained in:
Simon Giesecke 2020-02-03 22:53:50 +01:00 committed by Simon Giesecke
parent 0a1fc44ed7
commit 66094678d1
2 changed files with 13 additions and 0 deletions

View File

@ -116,6 +116,12 @@ void test_monitor_basic ()
if (event != ZMQ_EVENT_DISCONNECTED) {
TEST_ASSERT_EQUAL_INT (ZMQ_EVENT_MONITOR_STOPPED, event);
}
// TODO: When not waiting until the monitor stopped, the I/O thread runs
// into some deadlock. This must be fixed, but until it is fixed, we wait
// here in order to have more reliable test execution.
while (event != ZMQ_EVENT_MONITOR_STOPPED) {
event = get_monitor_event (server_mon, NULL, NULL);
}
// Close down the sockets
// TODO why does this use zero_linger?
@ -255,6 +261,12 @@ void test_monitor_versioned_basic (bind_function_t bind_function_,
if (event != ZMQ_EVENT_DISCONNECTED) {
TEST_ASSERT_EQUAL_INT (ZMQ_EVENT_MONITOR_STOPPED, event);
}
// TODO: When not waiting until the monitor stopped, the I/O thread runs
// into some deadlock. This must be fixed, but until it is fixed, we wait
// here in order to have more reliable test execution.
while (event != ZMQ_EVENT_MONITOR_STOPPED) {
event = get_monitor_event_v2 (server_mon, NULL, NULL, NULL);
}
free (client_local_address);
free (client_remote_address);

View File

@ -346,6 +346,7 @@ void shutdown_context_and_server_side (void *zap_thread_,
zmq_unbind (zap_control_, "inproc://handler-control"));
}
test_context_socket_close (zap_control_);
zmq_socket_monitor (server_, NULL, 0);
test_context_socket_close (server_mon_);
test_context_socket_close (server_);