Commit 66094678 authored by Simon Giesecke's avatar Simon Giesecke Committed by Simon Giesecke

Problem: intermittent deadlocks/timeouts in test_monitor and test_security_zap

Solution: wait for monitor to stop resp. unregister monitor before
closing monitored socket.
parent 0a1fc44e
...@@ -116,6 +116,12 @@ void test_monitor_basic () ...@@ -116,6 +116,12 @@ void test_monitor_basic ()
if (event != ZMQ_EVENT_DISCONNECTED) { if (event != ZMQ_EVENT_DISCONNECTED) {
TEST_ASSERT_EQUAL_INT (ZMQ_EVENT_MONITOR_STOPPED, event); 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 // Close down the sockets
// TODO why does this use zero_linger? // TODO why does this use zero_linger?
...@@ -255,6 +261,12 @@ void test_monitor_versioned_basic (bind_function_t bind_function_, ...@@ -255,6 +261,12 @@ void test_monitor_versioned_basic (bind_function_t bind_function_,
if (event != ZMQ_EVENT_DISCONNECTED) { if (event != ZMQ_EVENT_DISCONNECTED) {
TEST_ASSERT_EQUAL_INT (ZMQ_EVENT_MONITOR_STOPPED, event); 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_local_address);
free (client_remote_address); free (client_remote_address);
......
...@@ -346,6 +346,7 @@ void shutdown_context_and_server_side (void *zap_thread_, ...@@ -346,6 +346,7 @@ void shutdown_context_and_server_side (void *zap_thread_,
zmq_unbind (zap_control_, "inproc://handler-control")); zmq_unbind (zap_control_, "inproc://handler-control"));
} }
test_context_socket_close (zap_control_); test_context_socket_close (zap_control_);
zmq_socket_monitor (server_, NULL, 0);
test_context_socket_close (server_mon_); test_context_socket_close (server_mon_);
test_context_socket_close (server_); test_context_socket_close (server_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment