Assertion and consequent crash on Bad FD when reconnecting to a TCP server
Description
Here's an excerpt from backtrace I found from one of many (100s) tests so I used low prio.
#2 0x00007f07477a3659 in zmq::zmq_abort (errmsg_=0x62f5 <Address 0x62f5 out of bounds&gt at err.cpp:76 #3 0x00007f07477a3288 in zmq::epoll_t::add_fd (this=0x1e1be10, fd_=<value optimized out>, events_=0x1b7fe80) at epoll.cpp:69 #4 0x00007f07477ba33f in zmq::tcp_connecter_t::start_connecting (this=0x1b7fc80) at tcp_connecter.cpp:164 #5 0x00007f07477ad979 in zmq:oller_base_t::execute_timers (this=0x1e1be10) at poller_base.cpp:89 #6 0x00007f07477a2e65 in zmq::epoll_t::loop (this=0x1e1be10) at epoll.cpp:138 #7 0x00007f07477bb62b in thread_routine (arg_=0x1e1be80) at thread.cpp:83
Suspected reason: a misleading check of global errno==EINPROGRESS when file descriptor is assumed to be -1 (=retired_fd), see src/tcp_connecter.cpp (zmq::tcp_connecter_t::start_connecting()).
Here's an excerpt from backtrace I found from one of many (100s) tests so I used low prio.
#2 0x00007f07477a3659 in zmq::zmq_abort (errmsg_=0x62f5 <Address 0x62f5 out of bounds&gt at err.cpp:76
#3 0x00007f07477a3288 in zmq::epoll_t::add_fd (this=0x1e1be10, fd_=<value optimized out>, events_=0x1b7fe80) at epoll.cpp:69
#4 0x00007f07477ba33f in zmq::tcp_connecter_t::start_connecting (this=0x1b7fc80) at tcp_connecter.cpp:164
#5 0x00007f07477ad979 in zmq:oller_base_t::execute_timers (this=0x1e1be10) at poller_base.cpp:89
#6 0x00007f07477a2e65 in zmq::epoll_t::loop (this=0x1e1be10) at epoll.cpp:138
#7 0x00007f07477bb62b in thread_routine (arg_=0x1e1be80) at thread.cpp:83
Suspected reason: a misleading check of global errno==EINPROGRESS when file descriptor is assumed to be -1 (=retired_fd), see src/tcp_connecter.cpp (zmq::tcp_connecter_t::start_connecting()).
Commit that might become a fix:
https://github.com/mb78/zeromq3-x/commit/d163f5248f452db0cc63b4c8bed4ce5ba70a322d