tag:blogger.com,1999:blog-18508356.post7139963377421178778..comments2023-05-21T09:53:50.042-04:00Comments on Just a little Python: Using ZeroMQ devices to support complex network topologiesRick Copelandhttp://www.blogger.com/profile/11612114223288841087noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-18508356.post-65251593845206179102013-04-09T09:40:31.138-04:002013-04-09T09:40:31.138-04:00Unfortunately I don't have an example handy ri...Unfortunately I don't have an example handy right now, but if I recall correctly, things work best if you create the context after forking your subprocesses. (And if you're talking about the multiprocessing library in Python in particular, I don't have any experience making that work with 0MQ.)Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-81024431748255820512013-04-09T01:38:16.550-04:002013-04-09T01:38:16.550-04:00Any exampe for using context in multiprocess. Any exampe for using context in multiprocess. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18508356.post-13140525270976433832012-09-04T12:07:36.561-04:002012-09-04T12:07:36.561-04:00Dan,
Thanks for the comment! I had not realized t...Dan,<br /><br />Thanks for the comment! I had not realized that zmq sockets were not thread-safe. My guess is that I've only not seen crashing because I'd only send in one thread and recv in another, but it's certainly a bad approach. (Of course, with gevent_zeromq, the problem goes away since everything is implemented in a single thread). <br /><br />Great catch!Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-35406502365036152442012-08-30T11:30:54.274-04:002012-08-30T11:30:54.274-04:00Hi there!
I think your example using threads is a...Hi there!<br /><br />I think your example using threads is a little dangerous, as you're sharing sockets between threads. This is unsupported. See the section on 'thread safety' here:<br /><br /> http://api.zeromq.org/2-1:zmq-socket<br /><br />Otherwise, thanks for a great little article!Dan Fairshttps://www.blogger.com/profile/16027583555410283856noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-84491217054226193262012-08-30T10:43:16.970-04:002012-08-30T10:43:16.970-04:00You are absolutely correct. Thanks for catching th...You are absolutely correct. Thanks for catching that for me! I've corrected the article.Rick Copelandhttps://www.blogger.com/profile/01076166064171435559noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-63416812522258379082012-08-29T18:23:41.356-04:002012-08-29T18:23:41.356-04:00"...combine the easy networking topologies of..."...combine the easy networking topologies of ZeroMQ with the cooperative multitasking of ZeroMQ"<br /><br /><br />That should probably be the "cooperative multitasking of gevent", right?Jessnoreply@blogger.com