Skip to content
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

zmq.green can miss events #199

Closed
tailhook opened this issue Apr 20, 2012 · 1 comment · Fixed by #207
Closed

zmq.green can miss events #199

tailhook opened this issue Apr 20, 2012 · 1 comment · Fixed by #207
Labels

Comments

@tailhook
Copy link
Contributor

As you know ZMQ_FD implementation is edge triggered. Furthermore if any special method called on the socket, event is consumed (cleared). By special method I mean zmq_recv, zmq_send and zmq_getsockopt (latter at least with ZMQ_EVENTS option). So after reading, you must check if writing end should be waked up, and vice versa. I mean instead:

return _original_Socket.send(self, data, flags, copy, track)

It's better to write something like this:

message = _original_Socket.send(self, data, flags, copy, track)
self.__state_changed()
return message

And similar change should be for writing end.

Note: Care must be taken to not to wake up another greenlet in the middle of multi-part message.

@minrk
Copy link
Member

minrk commented Apr 20, 2012

Thanks for the note. It would appear that bringing gevent_zeromq into pyzmq was a bit premature, and per Travis' recommendation, zmq.green will likely not be in the upcoming pyzmq-2.2.0 release, so it can bake in master for a while longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants