[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang
Michael P. Reilly arc...@gmail.com added the comment: Here is a patch to socketserver.py which can be applied to 2.6, 2.7 and 3.2. The fix is for BaseServer, ForkingMixIn and ThreadingMixIn. All three now correctly respond to the shutdown method. I have no way of testing Windows or MacOSX (based on docs, MacOSX should work without changes); the ForkingMixIn will raise an AssertionError on non-POSIX systems. There may be a better way of handling non-POSIX systems, but again, I'm not able to test or develop at this time. I'll also update the simpletest.py script. -- versions: +Python 3.2 Added file: http://bugs.python.org/file24093/socketserver.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12463 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang
Michael P. Reilly arc...@gmail.com added the comment: An update test program. Execute with appropriate PYTHONPATH (to dir to patched module and explicit interpreter executable: PYTHONPATH=$PWD/2.7/b/Lib python2.7 $PWD/simpletest.py -- Added file: http://bugs.python.org/file24094/simpletest.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12463 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang
Michael P. Reilly arc...@gmail.com added the comment: I'm seeing that shutdown does have a race condition just using BaseHTTPServer.HTTPServer. See the attached simple script. Then access http://localhost:8081. This is using both Python 2.6.6 (r266:84292, May 22 2011, 16:47:42) on Oracle Linux Server 6.1 and Python 2.7.2+ (default, Oct 4, 2011, 20:03:08) on Ubuntu 11.10. I have applied the socketserver.patch dated 2011-07-25 18:43, with the same result. The problem is that shutdown() waits for the event, which is never triggered since there is no thread to set the event. I'll see if I can come up with a patch myself later this weekend. I suspect the same might happen with ForkingMixIn. -- nosy: +Arcege versions: +Python 2.6 -Python 3.2, Python 3.3 Added file: http://bugs.python.org/file24083/simple.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12463 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com