Opened 11 years ago

Closed 11 years ago

#1782 defect closed fixed (fixed)

web2's WSGIHandler incorrectly advertises twisted as a multiprocess environment

Reported by: pjenvey Owned by:
Priority: normal Milestone:
Component: web2 Keywords:
Cc: Branch:


web2's WSGIHandler incorrectly sets the 'wsgi.multiprocess' option to True

The WSGI PEP might not explain this in the clearest manner, but this option is reserved for environments that spawn separate processes for separate requests (such as Apache, mod_python)

This incorrect setting leads to WSGI apps making incorrect assumptions about the environment (Paste is a good example -- it disables the EvalException debugging tool if this value is True)

Change History (6)

comment:1 Changed 11 years ago by pjenvey

Summary: web2 wsgi's environment incorrectly advertises itself as a multiprocess environmentweb2's WSGIHandler incorrectly advertises twisted as a multiprocess environment

comment:2 Changed 11 years ago by jknight

The PEP says:

This value should evaluate true if an equivalent application object may be simultaneously invoked by another process, and should evaluate false otherwise.

That wording led me to believe it was safest to always set it to true, as it indeed _may_ be invoked by another process. But looking back again, I agree it should actually be False.

comment:3 Changed 11 years ago by jknight

Sorry for taking so long to get to this. Simplest patch ever, of course. :)

---     (revision 17257)
+++     (working copy)
@@ -109,7 +109,7 @@
         env['wsgi.input']        = InputStream(
         env['wsgi.errors']       = ErrorStream()
         env['wsgi.multithread']  = True
-        env['wsgi.multiprocess'] = True
+        env['wsgi.multiprocess'] = False
         env['wsgi.run_once']     = False
         env['wsgi.file_wrapper'] = FileWrapper
         self.environment = env

comment:4 Changed 11 years ago by David Reid

Apply Apply!

comment:5 Changed 11 years ago by foom

Resolution: fixed
Status: newclosed

(In [17258]) Set wsgi.multiprocess to False rather than True, to better comply with what the WSGI spec meant to say.

Author: jknight Reviewer: dreid Fixes #1782

comment:6 Changed 6 years ago by <automation>

Owner: jknight deleted
Note: See TracTickets for help on using tickets.