ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Segfaults with invalid application #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Use the following WSGI application:
def application(environ, start_response):
    return None
2. Access the URL that will launch it (depends on configuration)

What is the expected output? What do you see instead?

I expect an error message in the logs (it's obviously invalid application)
and 500 Internal Server Error, but mod_wsgi causes Apache to segfault (and
display white page).

What version of the product are you using? On what operating system?

mod_wsgi-2.0 on Gentoo Linux, apache-2.2.8

Please provide any additional information below.

Application was launched in mod_wsgi in embedded mode.

Original issue reported on code.google.com by phajdan.jr on 18 Jun 2008 at 2:15

GoogleCodeExporter commented 8 years ago
Patch against mod_wsgi version 3.0 source code revision 927 is:

Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c  (revision 927)
+++ mod_wsgi.c  (working copy)
@@ -3159,7 +3159,7 @@
                     self->result = OK;
             }

-            Py_DECREF(iterator);
+            Py_XDECREF(iterator);
         }

         if (PyErr_Occurred()) {

This eliminates crash and error message in log is then:

[Thu Jun 19 00:30:21 2008] [info] [client ::1] mod_wsgi (pid=1498, 
process='wsgi', application=''): Loading WSGI script 
'/usr/local/wsgi/scripts/none.py'.
[Thu Jun 19 00:30:21 2008] [error] [client ::1] mod_wsgi (pid=1498): Exception 
occurred processing WSGI script '/usr/local/wsgi/scripts/none.py'.
[Thu Jun 19 00:30:21 2008] [error] [client ::1] TypeError: iteration over 
non-sequence

Original comment by Graham.Dumpleton@gmail.com on 18 Jun 2008 at 2:32

GoogleCodeExporter commented 8 years ago
Note that this problem was only introduced in mod_wsgi version 2.0 and is not 
present in version 1.3.

The above patch is actually for version 2.0, not 3.0 code.

Original comment by Graham.Dumpleton@gmail.com on 18 Jun 2008 at 2:38

GoogleCodeExporter commented 8 years ago
Fixed in mod_wsgi 1.4 and 2.1.

Original comment by Graham.Dumpleton@gmail.com on 7 Jul 2008 at 2:16