-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to re-eastablish connection? #49
Comments
Hi jaro @jaromrax, Thanks for your question. One disadvantage of the ZMQ REQ/REP messaging pattern is that the sender needs to restart if the imagehub (receiver) is restarted. This is expected ZMQ behavior and is mentioned in the ZMQ documentation. I use the REQ/REP pattern in my own production systems and REQ/REP does require a timeout watch method in the sender program. I mention one sender timeout technique using the Linux There are other ways a REP timeout watcher could be implemented; some “more robust REQ/REP patterns” are discussed in the ZMQ documentation here. In my own imagenode programs, I restart the sender program when the imagehub program is restarted. I use 2 different timeout techniques. Both of these techniques are in my imagenode GitHub repository: 1) using a try except block for each REQ that sets a timeout using One of the imageZMQ users (Pat Ryan @youngsoul) developed a different technique for a REP timeout watcher and ImageSender restart. I mention it in the Useful Forks section of the imagaZMQ README.rst. The direct link to the Pat’s code is here: Pat’s code uses signal.SIGALRM. Note that you can close and restart the Thanks for your question. It is a good one, so I will put together a few examples of the above and add them to the Jeff |
Thank you very much, for very elaborate and kind response, I am just in the middle of trying @youngsoul solution now. I have found it earlier than the references you point at. Do you think, there are some functional differences between the two approaches? |
Hi Jaro, |
Dear Jeff, |
Hi Jaro, One thing you might want to try is set the zmq.LINGER option after each start or restart of the sender: sender = imagezmq.ImageSender(connect_to=hub_address)
sender.zmq_socket.setsockopt(zmq.LINGER, 0) # prevents ZMQ error on exit That helped eliminate some restart errors for me. |
Dear Jeff. |
Hi Jaro, |
Dear Jeff, sorry for not coming back for so long. That sounds great, I just tried to see the branches (it is long from October), but I see no other branches are in |
Hi Jaro @jaromrax,
I hope this helps. Let me know if you have other questions. |
Hello,
I have seen the project long ago, only now I tried.
However, I found, that if imagehub (receiver) is restarted, the sender is stalled.
Probably waiting the 'OK' response. Is there a way to timeout the sender?
Pointing to an IP from the client and shooting an image is very convenient, but the interruption means a kill and restart on client...
thank you
jaro
The text was updated successfully, but these errors were encountered: