This is one of the causes of spurious retries on our CI tests. I've been doing some analysis, and it was relatively easy to get the problem to repeat. After 14 tries, this happened:
tried 13 times
cycle.kill.kill 2:000140750 [ ok ]
cycle.worker.single startup/shutdown 0:001611553 [ ok ]
cycle.server_startup().server_startup(1) 1:001624276 [ ok ]
cycle.server_startup().server_startup(many) 20:047278546 [ ok ]
cycle.server_startup().shutdown_and_remove() 0:000085085 [ ok ]
cycle.server_startup().server_startup(many) 20:049186806 [ ok ]
cycle.server_startup().server_startup() with bind() conflict 0:000000629 [ ok ]
tried 14 times
cycle.kill.kill 2:000180426 [ ok ]
cycle.worker.single startup/shutdown 0:003570175 [ ok ]
cycle.server_startup().server_startup(1) 1:003090167 [ ok ]
libtest/client.cc:268: in start() pid(8858) localhost:54428 ping(libtest/client.cc:268: Connection refused), additionally pid: 9031 is alive: true waited: 17 server started. exec: /home/clint/src/gearman/gearmand/libtool --mode=execute /home/clint/src/gearman/gearmand/./gearmand/gearmand --verbose=INFO --log-file=var/log/gearmand.logNt7BSZ --pid-file=var/run/gearmand.pidLHPdDC --port=54428 --listen=localhost stderr:
tests/cycle.cc:113: in server_startup_multiple_TEST() pid(8858) Assertion '__server_startup_TEST((cycle_context_st*)obj, 20)' != 'TEST_SUCCESS'
cycle.server_startup().server_startup(many) [ failed ]
cycle.server_startup().shutdown_and_remove() 0:016349708 [ ok ]
cycle.server_startup().server_startup(many) 20:037825710 [ ok ]
cycle.server_startup().server_startup() with bind() conflict 0:000000453 [ ok ]
The mentioned log file shows this:
INFO 2016-11-29 23:49:39.253396 [ main ] Initializing Gear on port 54428 with SSL: false
INFO 2016-11-29 23:49:39.000000 [ main ] Starting up with pid 9031, verbose is set to INFO
ERROR 2016-11-29 23:50:00.000000 [ main ] Timeout occurred when calling bind() for 127.0.0.1:54428 -> libgearman-server/gearmand.cc:688
INFO 2016-11-29 23:50:00.000000 [ main ] Shutdown complete
Normal runs show this:
INFO 2016-11-29 23:45:36.616470 [ main ] Initializing Gear on port 22942 with SSL: false
INFO 2016-11-29 23:45:36.000000 [ main ] Starting up with pid 5764, verbose is set to INFO
INFO 2016-11-29 23:45:36.000000 [ main ] Listening on 127.0.0.1:22942 (13)
INFO 2016-11-29 23:45:36.000000 [ main ] Adding event for listening socket (13)
INFO 2016-11-29 23:45:36.000000 [ main ] Accepted connection from 127.0.0.1:49006
INFO 2016-11-29 23:45:36.000000 [ 4 ] Peer connection has called close()
INFO 2016-11-29 23:45:36.000000 [ 4 ] Disconnected 127.0.0.1:49006
INFO 2016-11-29 23:45:36.000000 [ 4 ] Gear connection disconnected: -:-
INFO 2016-11-29 23:45:43.000000 [ main ] Clearing event for listening socket (13)
INFO 2016-11-29 23:45:43.000000 [ main ] Closing listening socket (13)
INFO 2016-11-29 23:45:43.000000 [ main ] Shutdown complete
My guess is that the function that detects free ports doesn't hang on to that port, and so other things happening on the box take that port, causing an error/timeout in binding to it.
This is one of the causes of spurious retries on our CI tests. I've been doing some analysis, and it was relatively easy to get the problem to repeat. After 14 tries, this happened:
The mentioned log file shows this:
Normal runs show this:
My guess is that the function that detects free ports doesn't hang on to that port, and so other things happening on the box take that port, causing an error/timeout in binding to it.