On Fri, 2017-12-29 at 22:32 +0100, Pavol wrote: > Hello, > > I'm trying to get udpping3 example > <http://zguide.zeromq.org/page:all#Designing-the-API> from ØMQ Guide > working. Originally I tried GitHub issue tracker (#715 > <https://github.com/booksbyus/zguide/issues/715>) and Kevin Sapper > advised > to ask on a mailing list. Feel free to head there for more verbose > context. > > With the current code (udpping3.py, udplib.py and interface.py) I get > ZMQError: Socket operation on non-socket. I *guess* this happens > because > InterfaceAgent thread closes pipe first and later Interface tries to > close > pipe as well. If I remove that self.pipe.close() from InterfaceAgent > I > don't get error mentioned above anymore. > > With this modified example I end up with different issue. Main > Interface > class hangs on context termination. I've read Making a Clean Exit > <http://zguide.zeromq.org/page:all#Making-a-Clean-Exit> part of the > guide. > I don't see suggested linger setting on a socket so I hoped python > bindings > does that somehow. > > I'm wondering if example doesn't exit properly or what could be the > issue? > > > For more details feel free to peek in the issue on GitHub: > https://github.com/booksbyus/zguide/issues/715
After a quick glance there are a couple of race conditions in that example - one of the socket is created in thread 0, used in thread 1 and then closed in thread 0. Sockets are not thread safe. That might, or might not, be the issue. I would suggest to focus on the bigger picture with these examples - see what capabilities, features and network patterns are possible and how to implement them, at a higher level. Implementation details like perfectly handling ctrl-c are besides the point. -- Kind regards, Luca Boccassi
signature.asc
Description: This is a digitally signed message part
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
