Conversation
|
I'm ignoring CodeFactor and Stickler complaints, they are something that should be handled in a separate test refactoring PR. |
|
How about syncing with the linger timeout? Because I think this is the reason the bind fails. |
|
What does "linger timeout" mean? |
|
We set the linger timeout here: https://github.com/pytroll/posttroll/blob/master/posttroll/publisher.py#L143 Basically that's how much time we give the socket to shut off all connections cleanly, and it's set here to one second. And I suspect that's why you get the error in the first place, since the previous connection doesn't have time to shut down cleanly before you create a new one one the same port. |
|
This page says the timeout is in milliseconds: http://api.zeromq.org/2-1:zmq-setsockopt At the moment I'm still having occasional problems with 2 second (10 x 0.2 seconds) wait. |
|
oh, ok. Then I suppose TIME_WAIT is the culprit. Not too much we can do about that. |
mraspaud
left a comment
There was a problem hiding this comment.
Thanks for adding this. Some inline comments.
|
I started to make the requested changes and add tests, but have come to the conclusion that this won't really solve the problem I've been having. So, instead of defining the port, I now let the Trollflow2 publisher to have any free port from a given range by defining I can still finish this PR if it is seen to be usable, IIRC I have only one of the suggestions unfinished. @mraspaud? |
|
Pushed the changes in any case, but will convert to a Draft PR. |
This PR fixes an occasional
zmq.error.ZMQError: Address already in useI get in Trollflow2. This happens when a new publisher is created with the same port as the one closed immediately before and OS hasn't had time to free the port.Minimal code that shows the error with current
masterbranch: