Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue8138

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:wsgiref.simple_server.SimpleServer claims to be multithreaded
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: berker.peksag, djc, pje, sgala
Priority:normalKeywords:patch

Created on2010-03-14 18:08 bysgala, last changed2022-04-11 14:56 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
multithread.patchsgala,2014-10-02 21:36Patch so that simple_server.py doesn't claim falsely it is multithreaded
Pull Requests
URLStatusLinkedEdit
PR 12977mergedberker.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)*(Python committer)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)*(Python committer)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)*(Python committer)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
DateUserActionArgs
2022-04-11 14:56:58adminsetgithub: 52385
2019-05-24 17:25:12berker.peksagsetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: - Python 3.7
2019-05-24 17:24:46berker.peksagsetmessages: +msg343413
2019-04-27 00:01:28berker.peksagsetmessages: +msg340952
versions: + Python 3.7, Python 3.8, - Python 2.7, Python 3.4, Python 3.5
2019-04-27 00:00:19berker.peksagsetpull_requests: +pull_request12903
2019-04-26 17:52:10BreamoreBoysetnosy: -BreamoreBoy
2014-10-05 04:45:59berker.peksagsetmessages: +msg228539
2014-10-05 03:44:56berker.peksagsetnosy: +berker.peksag

stage: patch review
2014-10-02 21:36:10sgalasetfiles: +multithread.patch
keywords: +patch
messages: +msg228262
2014-10-01 21:05:50BreamoreBoysetnosy: +BreamoreBoy

messages: +msg228121
versions: + Python 2.7, Python 3.4, Python 3.5, - Python 2.6
2010-08-03 14:24:19djcsetnosy: +djc
2010-07-12 14:19:06BreamoreBoysetnosy: +pje
2010-03-14 18:11:33sgalasettype: behavior
components: + Library (Lib)
2010-03-14 18:08:54sgalacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp