[Web-SIG] WSGI (PEP 333) error handling questions

Péter Szabó ptspts at gmail.com
Sun Jan 3 17:18:33 CET 2010


Hi,

After reading http://www.python.org/dev/peps/pep-0333/ it is not clear
to me what a WSGI server should do in case of some error situations:

S1. An I/O error (such as Connection reset by peer) occurs when
reading environ['wsgi.input'].

S2. An I/O error occurs when writing environ['wsgi.error'].

S3. An I/O error occurs when start_response is sending the HTTP
response headers.

S4. An I/O error (such as Connection reset by peer or Broken pipe)
occurs when writing to the write() callable returned by
start_response().

S5. An I/O error (such as Connection reset by peer or Broken pipe)
occurs when yielding some HTTP response strings.

My guesses would be:

S1. Raise an IOError. If the application doesn't catch it, then abort
the call to the application, and close the HTTP connection.

S2a. Same as S1.
S2b. Ignore the error silently.

S3a. Same as S1.
S3b. Close the HTTP connection, let the application call continue, and
ignore the error silently.

S4a. Same as S1.
S4b. Close the HTTP connection, let the application call continue, and
ignore the error silently.

S5a. Abort the application call (without giving the application a
chance to catch the exception) and close the HTTP connection.
S5b. Close the HTTP connection, let the application call continue, and
ignore the error silently.

Could you please clarify what should happen in these situations?

Thanks,

Péter


More information about the Web-SIG mailing list