Skip to content

Conversation

@vitawasalreadytaken
Copy link

The pubsub worker thread was sometimes dying on me silently because my process was interrupted by a signal while pubsub.get_message -> pubsub.parse_response -> connection.can_read -> select.select was blocking.

This fix simply ignores InterruptedErrors raised during the select poll and retries. I have been testing this in production for about half a year now.

Note that this is only needed for Python < 3.5. In 3.5 select ignores interruptions and retries automatically (https://docs.python.org/3/library/select.html#select.select).

@andymccurdy
Copy link
Contributor

This is similar to #743 which was just merged. But #743 doesn't take into account select.

cc @carltongibson, thoughts?

@carltongibson
Copy link
Contributor

carltongibson commented Jun 6, 2016

My initial thought is to handle this in the connection (in can_read) where the select call occurs rather than the PubSubWorkerThread.

For neatness, it'd be nice to wrap it in a _compat.py function too.

But, yeah, I think we should handle this.

carltongibson added a commit to carltongibson/redis-py that referenced this pull request Jun 10, 2016
@andymccurdy
Copy link
Contributor

I merged @carltongibson's change which should fix this.

@vitawasalreadytaken
Copy link
Author

Cool, that's a nicer way to handle this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants