
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2010-03-14 18:08 bysgala, last changed2022-04-11 14:56 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| multithread.patch | sgala,2014-10-02 21:36 | Patch so that simple_server.py doesn't claim falsely it is multithreaded | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 12977 | merged | berker.peksag,2019-04-27 00:00 | |
| Messages (6) | |||
|---|---|---|---|
| msg101058 -(view) | Author: Santiago Gala (sgala) | Date: 2010-03-14 18:08 | |
In python 2.6, a server created with wsgiref.simple_server.make_server willclaim to be multithreaded and multiprocess through it wsgi environ. See wsgi.multithread in the browser page after launching $ python /usr/lib/python2.6/wsgiref/simple_server.pyThe 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. | |||
| msg228121 -(view) | Author: Mark Lawrence (BreamoreBoy)* | Date: 2014-10-01 21:05 | |
@Santiago can you provide a patch for this issue? | |||
| msg228262 -(view) | Author: Santiago Gala (sgala) | Date: 2014-10-02 21:36 | |
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.py2014-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()) | |||
| msg228539 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2014-10-05 04:45 | |
Looks like Werkzeug had a workaround for this bug:https://github.com/mitsuhiko/werkzeug/commit/f9e2fad30d34a6b0737539434c03c07c2bc658d4 | |||
| msg340952 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2019-04-27 00:01 | |
It's not easy to write a test for this, so I might mergePR 12977 without a test. | |||
| msg343413 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2019-05-24 17:24 | |
New changeset14738ff83d852c95a0cf33e5c90a85860a9c5620 by Berker Peksag in branch 'master':bpo-8138: Initialize wsgiref's SimpleServer as single-threaded (GH-12977)https://github.com/python/cpython/commit/14738ff83d852c95a0cf33e5c90a85860a9c5620 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:58 | admin | set | github: 52385 |
| 2019-05-24 17:25:12 | berker.peksag | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: - Python 3.7 |
| 2019-05-24 17:24:46 | berker.peksag | set | messages: +msg343413 |
| 2019-04-27 00:01:28 | berker.peksag | set | messages: +msg340952 versions: + Python 3.7, Python 3.8, - Python 2.7, Python 3.4, Python 3.5 |
| 2019-04-27 00:00:19 | berker.peksag | set | pull_requests: +pull_request12903 |
| 2019-04-26 17:52:10 | BreamoreBoy | set | nosy: -BreamoreBoy |
| 2014-10-05 04:45:59 | berker.peksag | set | messages: +msg228539 |
| 2014-10-05 03:44:56 | berker.peksag | set | nosy: +berker.peksag stage: patch review |
| 2014-10-02 21:36:10 | sgala | set | files: +multithread.patch keywords: +patch messages: +msg228262 |
| 2014-10-01 21:05:50 | BreamoreBoy | set | nosy: +BreamoreBoy messages: +msg228121 versions: + Python 2.7, Python 3.4, Python 3.5, - Python 2.6 |
| 2010-08-03 14:24:19 | djc | set | nosy: +djc |
| 2010-07-12 14:19:06 | BreamoreBoy | set | nosy: +pje |
| 2010-03-14 18:11:33 | sgala | set | type: behavior components: + Library (Lib) |
| 2010-03-14 18:08:54 | sgala | create | |