Closed rp- closed 7 years ago
Hi, thanks a lot for the information. I wasn't aware of this.
Regarding the fix, what worries me a little is that try/catch blocks aren't cheap in a loop, I would rather make it more local or even get it outside the while block.
Yeah this just looked like a good spot, since there happens another polling within this loop. Didn't think about any performance implications.
According to this http://stackoverflow.com/questions/2522005/cost-of-exception-handlers-in-python, try/except might actually be faster than an if: if I am reading it right.
I just made a similar pull request before I saw this one that catches IOError. I don't think InterruptedError and IOError are related, and I was getting IOErrors IIRC. Is InterruptedError a subclass? Are there two different errors that the resume from suspend could be sending?
Here: http://sebastianraschka.com/Articles/python3_OSError.html it looks like InterruptedError derives from OSError(as does IOError) making them siblings.
This has been implemented by another pr directly in poller implementation. So the issue will not raise anymore (if select() returned something, i doubt read() will fail, but let's see.)
might happen if run through gdb or system hibernation
I'm not 100% sure if this fix is really 100 good, as I don't know which real interruptions could happen where ws4py wants to stop. But if you have cython compiled code with ws4py you can't use it with gdb anymore. see as a few references: http://stackoverflow.com/questions/2252981/gdb-error-unable-to-execute-epoll-wait-4-interrupted-system-call https://github.com/mopidy/mopidy/issues/718