ramkrishanbhatt / modwsgi

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

“child process exited with status 255” error #265

Closed GoogleCodeExporter closed 8 years ago

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

Build the latest mod_wsgi with Python 3.3.0a3 & Apache 2.2.22 in Windows 7 
(x64), and copy mod_wsgi to Apache’s /modules folder, then config Apache with 
this:

    LoadModule wsgi_module modules/mod_wsgi.so
    Alias /wsgi/ "E:/Websites/WSGI/"
    <Location "/wsgi/">
        Options +ExecCGI
        AddHandler wsgi-script .wsgi
        Order allow,deny
        Allow from all
    </Location>

Then restart Apache.

In E:/Websites/WSGI/, there’s a index.wsgi file:

    def application(environ, start_response):
        status = '200 OK' 
        output = 'Hello World!'

        response_headers = [('Content-type', 'text/plain'),
                            ('Content-Length', str(len(output)))]
        start_response(status, response_headers)

        return [output]

When I tried to access index.wsgi, I got error 101 (connection was reset). 
Apache’s log file says:

    Parent: child process exited with status 255 -- Restarting.

Every time I tried to access index.wsgi, the child process restarts.

Original issue reported on code.google.com by efanzh on 6 May 2012 at 10:36

GoogleCodeExporter commented 8 years ago
Your code is not a valid WSGI application for Python 3.X. Should be:

output = b'Hello World!'

Fix that for a start and see if it makes a difference.

Do be aware that Python 3.3 hasn't been tested at all and they nearly always 
subtly change stuff between Python versions that inevitably result in 
workarounds in mod_wsgi. The mod_wsgi trunk is also in a bit of a fluid state 
as far as Python 3.X and has had not real testing with it.

Original comment by Graham.Dumpleton@gmail.com on 6 May 2012 at 11:21

GoogleCodeExporter commented 8 years ago
No, it doesn’t work.

And also, if there’s something wrong with my code, shouldn't it be a 500 
internal server error? This is a connection reset error. And is it possible for 
a WSGI script to cause child process to restart?

Original comment by efanzh on 6 May 2012 at 11:36

GoogleCodeExporter commented 8 years ago
Additional comment for 
http://stackoverflow.com/questions/10458115/how-to-compile-mod-wsgi-with-apache-
2-2-python-3-2-for-windows:

I said it works because it can be successful compiled, but still can’t load 
the module (same error as before). It is a Python issue, so I think it won't be 
fixed unless use the next version of Python. so I begin to try Python 3.3, and 
this time, it can be successful loaded, then this.

Also, about the manifest issue. I think the .mk file should add /MANIFEST 
option in  LDFLAGS so that the linker can generate the manifest file.

Original comment by efanzh on 6 May 2012 at 11:49

GoogleCodeExporter commented 8 years ago
Not using bytes would have caused an error condition. It is possible that the 
error path itself was failing and causing process to crash and thus why asked 
you to check for valid WSGI application.

All else I can suggest right now is to ensure set:

LogLevel debug

in Apache configuration file and see what messages at all are generated by 
mod_wsgi as things are processed.

Original comment by Graham.Dumpleton@gmail.com on 6 May 2012 at 12:10

GoogleCodeExporter commented 8 years ago
Also try manually going into mod_wsgi.c and changing:

#if defined(WIN32) && PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 3
        _wputenv(L"PYTHONIOENCODING=cp1252:backslashreplace");
#endif

to just:

       _wputenv(L"PYTHONIOENCODING=mbcs:replace");

leaving out the #if/#endif around it for now.

Original comment by Graham.Dumpleton@gmail.com on 6 May 2012 at 12:12

GoogleCodeExporter commented 8 years ago
Change to

    _wputenv(L"PYTHONIOENCODING=mbcs:replace");

doesn’t work for Python 3.2. Same as before.

Here’s the log file for Python 3.3 version’s error log:

    [Sun May 06 20:40:21 2012] [notice] Apache/2.2.22 (Win32) mod_wsgi/4.0-TRUNK Python/3.3.0a3 configured -- resuming normal operations
    [Sun May 06 20:40:21 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun May 06 20:40:21 2012] [notice] Parent: Created child process 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(477): Parent: Sent the scoreboard to the child
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Child process is running
    [Sun May 06 20:40:21 2012] [info] mod_wsgi (pid=4912): Initializing Python.
    [Sun May 06 20:40:21 2012] [info] mod_wsgi (pid=4912): Attach interpreter ''.
    [Sun May 06 20:40:21 2012] [info] Parent: Duplicating socket 304 and sending it to child process 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(398): Child 4912: Retrieved our scoreboard from the parent.
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(595): Parent: Sent 1 listeners to child 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(554): Child 4912: retrieved 1 listeners from parent
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Acquired the start mutex.
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Starting 64 worker threads.
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Starting thread to listen on port 80.

Original comment by efanzh on 6 May 2012 at 12:46

GoogleCodeExporter commented 8 years ago
Try to access index.wsgi for the second time:

    [Sun May 06 20:40:21 2012] [notice] Apache/2.2.22 (Win32) mod_wsgi/4.0-TRUNK Python/3.3.0a3 configured -- resuming normal operations
    [Sun May 06 20:40:21 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun May 06 20:40:21 2012] [notice] Parent: Created child process 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(477): Parent: Sent the scoreboard to the child
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Child process is running
    [Sun May 06 20:40:21 2012] [info] mod_wsgi (pid=4912): Initializing Python.
    [Sun May 06 20:40:21 2012] [info] mod_wsgi (pid=4912): Attach interpreter ''.
    [Sun May 06 20:40:21 2012] [info] Parent: Duplicating socket 304 and sending it to child process 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(398): Child 4912: Retrieved our scoreboard from the parent.
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(595): Parent: Sent 1 listeners to child 4912
    [Sun May 06 20:40:21 2012] [debug] mpm_winnt.c(554): Child 4912: retrieved 1 listeners from parent
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Acquired the start mutex.
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Starting 64 worker threads.
    [Sun May 06 20:40:21 2012] [notice] Child 4912: Starting thread to listen on port 80.
    [Sun May 06 20:46:55 2012] [info] mod_wsgi (pid=4912): Create interpreter 'localhost|/wsgi/index.wsgi'.
    [Sun May 06 20:46:55 2012] [info] [client 127.0.0.1] mod_wsgi (pid=4912, process='', application='localhost|/wsgi/index.wsgi'): Loading WSGI script 'E:/EFanZh/Development/Websites/WSGI/index.wsgi'.
    [Sun May 06 20:46:57 2012] [notice] Parent: child process exited with status 255 -- Restarting.
    [Sun May 06 20:46:58 2012] [notice] Apache/2.2.22 (Win32) mod_wsgi/4.0-TRUNK Python/3.3.0a3 configured -- resuming normal operations
    [Sun May 06 20:46:58 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun May 06 20:46:58 2012] [notice] Parent: Created child process 5008
    [Sun May 06 20:46:58 2012] [debug] mpm_winnt.c(477): Parent: Sent the scoreboard to the child
    [Sun May 06 20:46:58 2012] [notice] Child 5008: Child process is running
    [Sun May 06 20:46:58 2012] [info] mod_wsgi (pid=5008): Initializing Python.
    [Sun May 06 20:46:58 2012] [info] mod_wsgi (pid=5008): Attach interpreter ''.
    [Sun May 06 20:46:58 2012] [info] Parent: Duplicating socket 304 and sending it to child process 5008
    [Sun May 06 20:46:58 2012] [debug] mpm_winnt.c(398): Child 5008: Retrieved our scoreboard from the parent.
    [Sun May 06 20:46:58 2012] [debug] mpm_winnt.c(595): Parent: Sent 1 listeners to child 5008
    [Sun May 06 20:46:58 2012] [debug] mpm_winnt.c(554): Child 5008: retrieved 1 listeners from parent
    [Sun May 06 20:46:58 2012] [notice] Child 5008: Acquired the start mutex.
    [Sun May 06 20:46:58 2012] [notice] Child 5008: Starting 64 worker threads.
    [Sun May 06 20:46:58 2012] [notice] Child 5008: Starting thread to listen on port 80.

Original comment by efanzh on 6 May 2012 at 12:48

GoogleCodeExporter commented 8 years ago
Believe this was likely an issue resulting from bug in Python at that time 
which has since been fixed. Closing.

Original comment by Graham.Dumpleton@gmail.com on 12 Nov 2014 at 10:26