-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wsgiref.simple_server.SimpleServer claims to be multithreaded #52385
Comments
In python 2.6, a server created with wsgiref.simple_server.make_server will $ python /usr/lib/python2.6/wsgiref/simple_server.py The bug is due to the default value in the constructor wsgiref.handlers.SimpleHandler, and it is misleading, as the servier is singlethreaded. It gives problems for any app that wants to change behavior or error on singlethreaded. The problem can be fixed very simply by patching a "multithreaded=False" argument into the ServerHandler constructor in simple_server. |
@santiago can you provide a patch for this issue? |
Something like this should do it: $ diff -u /usr/lib/python2.7/wsgiref/simple_server.py{~,}
--- /usr/lib/python2.7/wsgiref/simple_server.py~ 2014-10-02 23:32:47.718382895 +0200
+++ /usr/lib/python2.7/wsgiref/simple_server.py 2014-10-02 14:36:10.662220865 +0200
@@ -118,7 +118,8 @@
return
handler = ServerHandler(
- self.rfile, self.wfile, self.get_stderr(), self.get_environ()
+ self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
+ multithread = False
)
handler.request_handler = self # backpointer for logging
handler.run(self.server.get_app()) |
Looks like Werkzeug had a workaround for this bug:
|
It's not easy to write a test for this, so I might merge PR 12977 without a test. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: