Friday, September 30, 2011

Annoying select.error

I needed to move from Gevent back to wsgiref. The change was quite minimal thanks to WSGI abstraction.

But to my surprise, and much dismay, the server kept on crashing with select.error on CentOS 5.6. I believe it also exhibits this behavior on other POSIX compliant OSes. Some searching brought me to an issue filed back in February 2010.

Among the messages, Antoine Pitrou said select was wrapped in a try/finally block in Python 2.6 presumably to support signals and interrupted system calls. Why, then, do I still see interrupted syscall error?

In the end, I had to put a try/except clause similar to what was suggested in the second message (copied from Twisted) around serve_forever. This code looks quite funny with while True and serve_forever. You get what I mean?

No comments:

Post a Comment