-
Notifications
You must be signed in to change notification settings - Fork 538
Description
Running the czmq tests can cause this problem on QNX 6.3:
* zproxy: E: (czmq_selftest) 19-02-21 15:34:43 zproxy: invalid endpoints 'ipc://backend'
<path>/czmq-master/src/zproxy.c:200 *sock_p -- assertion failed
Abort (core dumped)
The code around line 200 in zproxy.c is:
static void
s_self_configure (self_t *self, zsock_t **sock_p, zmsg_t *request, proxy_socket selected_socket)
{
[snip]
*sock_p = s_self_create_socket (self, type_name, endpoints, selected_socket);
assert (*sock_p);
[snip]
}
The cause is that the 'backend' file is lingering on the filesystem (see backend_file.txt), so subsequent execution of the tests causes a SIGABRT due to this assertion. I got around this by deleting the file between test runs.
The issue for me is that terminating the application due to a system error such as this is unacceptable. Errors like this should be passed up to the application for it to handle. However, I see assert() statements scattered throughout the library code, and it is not clear to me that they are all being used properly - e.g., to verify pre-conditions and post-conditions that are fully under the control of the library developers. Using them to "handle" system errors is a bad practice.
Curiously, when I ran the tests using a Release build the same thing happened. That was surprising because I expect all the assert() statements to vanish for a release. (I was careful to make sure that the czmq_selftest executable was loading the Release libczmq shared library, not the Debug library.)