[zeromq-dev] Can't run tests concurrently due to hardcoded port numbers
Pieter Hintjens
ph at imatix.com
Tue Jul 22 19:34:14 CEST 2014
Good catch. We could definitely use ephemeral ports (libzmq supports
that), though it would take changes to most of the test cases. From
the zmq_tcp man page:
----
The TCP port number may be specified by:
· A numeric value, usually above 1024 on POSIX systems.
· The wild-card *, meaning a system-assigned ephemeral port.
When using ephemeral ports, the caller should retrieve the actual
assigned port using the ZMQ_LAST_ENDPOINT socket option. See
zmq_getsockopt(3) for details.
----
-Pieter
On Tue, Jul 22, 2014 at 5:25 PM, Greg Ward <greg at gerg.ca> wrote:
> Hi all --
>
> I stumbled across this because our build system (a local instance of
> OBS) uses chroot environments to build RPMs, with multiple chroots on
> a single host. If the zeromq 4.0.x tests happen to run concurrently in
> different chroots on the same host, they fail.
>
> You can reproduce this easily without a chroot: just run "make check"
> twice concurrently on the same host. Sample output:
>
> PASS: test_ctx_destroy
> PASS: test_security_null
> ../config/test-driver: line 107: 19440 Aborted (core dumped) "$@" > $log_file 2>&1
> FAIL: test_security_curve
> PASS: test_iov
> PASS: test_spec_req
> PASS: test_spec_dealer
> ../config/test-driver: line 107: 19596 Aborted (core dumped) "$@" > $log_file 2>&1
> FAIL: test_req_correlate
> ../config/test-driver: line 107: 19619 Aborted (core dumped) "$@" > $log_file 2>&1
> FAIL: test_req_relaxed
> PASS: test_conflate
> PASS: test_inproc_connect
>
> (These tests all pass just fine when run in isolation.)
>
> It's not hard to find the source of the problem:
>
> $ grep zmq_bind tests/test_*.cpp
> [...]
> tests/test_req_correlate.cpp: rc = zmq_bind (router, "tcp://127.0.0.1:5555");
> tests/test_req_relaxed.cpp: rc = zmq_bind (req, "tcp://127.0.0.1:5555");
> [...]
> tests/test_security_curve.cpp: rc = zmq_bind (server, "tcp://127.0.0.1:9998");
> [...]
>
> Is this fixable? Like, if we make all those test sockets bind to port
> 0 so the kernel picks an available port, is it easy to turn around and
> connect to that arbitrary port a few lines later?
>
> Thanks --
>
> Greg
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list