Occasionally my project using zmq crashes with this error printed to the terminal:
Address already in use (os error 48)
It is not printed from my code, and I can't find that text in zmq rust lib, so it's either printed by the underlying C/C++ lib, or passed back to zmq from it and printed.
From reading posts about that error message it seems to be due to a previous run not cleaning things up, but:
there is no previous process/thread left running using that port
it doesn't get solved by waiting minutes or hours. Only a machine (macos) restart seems to fix it
it's not returned by any call in my rust code to socket() or bind() or connect() as I check all those Results , it seems to happen soon after a bind() (but hard to tell). Could it be happening on a thread inside libzmq and not synchronously on my calls?
I use port_picker to try to chose an unused port prior to bind(), but it still happens. Is there any way to check for this condition prior to bind() so I can make my project chose another port and overall make it reliable and not crash.
Could I add some clean-up code on closure, panic or control-c of previous run to reduce this happening (I am just relying on standard drop methods at the moment)
Occasionally my project using zmq crashes with this error printed to the terminal:
It is not printed from my code, and I can't find that text in zmq rust lib, so it's either printed by the underlying C/C++ lib, or passed back to zmq from it and printed.
From reading posts about that error message it seems to be due to a previous run not cleaning things up, but:
Result
s , it seems to happen soon after a bind() (but hard to tell). Could it be happening on a thread inside libzmq and not synchronously on my calls?port_picker
to try to chose an unused port prior to bind(), but it still happens. Is there any way to check for this condition prior to bind() so I can make my project chose another port and overall make it reliable and not crash.drop
methods at the moment)