[zeromq-dev] Can't run tests concurrently due to hardcoded port numbers

Greg Ward greg at gerg.ca
Tue Jul 22 17:25:16 CEST 2014


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



More information about the zeromq-dev mailing list