gmr / rabbitpy

A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
http://rabbitpy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
243 stars 58 forks source link

IOLoop.run should catch select.error #43

Closed scharron closed 9 years ago

scharron commented 9 years ago

I'm having error: (4, 'Interrupted system call') from io.py (IOLoop.run) It seems in python 2.7 (and until 3.3 excluded) you must catch select.error to catch this error (see pep 3151)

gmr commented 9 years ago

I've just released 0.21.0 which hopefully addresses your issue. Without the stack trace, I guessed that the error was in the polling (select.select, kqueue.control, or poll.poll). Please let me know if this addresses your issue.

scharron commented 9 years ago

I'll try this release. However, why did not you catch the exception in the same except statement as the EnvironmentError in run() ?

gmr commented 9 years ago

Because the scope of catching the select error should be wrapped around the poll itself and not higher up. Catching it higher up would not allow it to recover in the same way.

gmr commented 9 years ago

In short, catching it where it does makes it transparent to your application, moving it up would impart side effects that would bubble up some way.

scharron commented 9 years ago

It works !

Totally agree (now that I realize again that select.error is an alias to OSError in python 3.3+) Thanks !