alihalabyah / modwsgi

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

mod_wsgi crashing Apache #275

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have compiled mod WSGI as follows 
Renaming the file win32-ap22py26.mk to win32-ap22py24.mk, and updating the 
paths in the file as follows

=====================================================================
CPPFLAGS = \
 /DWIN32 \
 /DNDEBUG \
 /I"H:\Program Files\Microsoft Visual Studio 8\VC\include" \
 /I"D:\Program Files\Microsoft SDKs\Windows\v7.0A\Include" \
 /I"G:\Apache2\include" \
 /I"D:\Python24\include"

CFLAGS = \
 /MD \
 /GF \
 /Gy \
 /O2 \
 /Wall \
 /Zc:wchar_t \
 /Zc:forScope

LDFLAGS = \
 /link \
 "/LIBPATH:H:\Program Files\Microsoft Visual Studio 8\VC\lib" \
 "/LIBPATH:D:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib" \
 "/LIBPATH:G:\Apache2\lib" \
 /LIBPATH:D:\Python24\libs \
 /OPT:REF \
 /OPT:ICF=2 \
 /RELEASE \
 /SUBSYSTEM:WINDOWS

LDLIBS = \
 python24.lib \
 libhttpd.lib \
 libapr-1.lib \
 libaprutil-1.lib

mod_wsgi.so : mod_wsgi.c
    cl $(CPPFLAGS) $(CFLAGS) $? /LD $(LDFLAGS) $(LDLIBS) /OUT:$@
    mt -manifest $@.manifest -outputresource:$@;2

clean :
    del *.obj *.so *.so.manifest *.lib *.exp

================================================================================
==========

after running nmake command it creates mod_wsgi.so

In http.conf added 
LoadModule wsgi_module modules/mod_wsgi.so

and also added the following 

WSGIScriptAlias /abc G:/Apache2/htdocs/abc/wsgi.py

<Directory "G:/Apache2/htdocs/abc/mysite">
    AllowOverride None
    Options None
    Order deny,allow
    Allow from all
</Directory>

Now When I load http://localhost/abc Apache Crashes and a popup window appears 
"Apache HTTP Server has encountered a problem and needs to close.  We are sorry 
for the inconvenience."

I have also set LogLevel to debug in http.conf, but not able to find any issue 

[Wed Oct 31 19:12:44 2012] [info] mod_wsgi (pid=2572): Create interpreter 
'localhost|/abc'.
[Wed Oct 31 19:12:44 2012] [info] [client 127.0.0.1] mod_wsgi (pid=2572, 
process='', application='localhost|/abc'): Loading WSGI script 
'G:/Apache2/htdocs/abc/wsgi.py'.
[Wed Oct 31 19:13:11 2012] [error] [client 192.168.1.8] File does not exist: 
G:/Apache2/htdocs/favicon.ico
[Wed Oct 31 19:14:24 2012] [notice] Parent: child process exited with status 
3221225477 -- Restarting.
[Wed Oct 31 19:14:24 2012] [notice] Apache/2.2.10 (Win32) mod_wsgi/3.4 
Python/2.4.3 configured -- resuming normal operations
[Wed Oct 31 19:14:24 2012] [notice] Server built: Nov 11 2008 16:22:16
[Wed Oct 31 19:14:24 2012] [notice] Parent: Created child process 4340
[Wed Oct 31 19:14:24 2012] [debug] mpm_winnt.c(487): Parent: Sent the 
scoreboard to the child
[Wed Oct 31 19:14:24 2012] [notice] Child 4340: Child process is running
[Wed Oct 31 19:14:24 2012] [debug] mpm_winnt.c(408): Child 4340: Retrieved our 
scoreboard from the parent.
[Wed Oct 31 19:14:24 2012] [info] Parent: Duplicating socket 208 and sending it 
to child process 4340
[Wed Oct 31 19:14:24 2012] [debug] mpm_winnt.c(605): Parent: Sent 1 listeners 
to child 4340
[Wed Oct 31 19:14:24 2012] [debug] mpm_winnt.c(564): Child 4340: retrieved 1 
listeners from parent
[Wed Oct 31 19:14:24 2012] [info] mod_wsgi (pid=4340): Initializing Python.
[Wed Oct 31 19:14:25 2012] [info] mod_wsgi (pid=4340): Attach interpreter ''.
[Wed Oct 31 19:14:25 2012] [notice] Child 4340: Acquired the start mutex.
[Wed Oct 31 19:14:25 2012] [notice] Child 4340: Starting 50 worker threads.
[Wed Oct 31 19:14:25 2012] [notice] Child 4340: Starting thread to listen on 
port 80.

Thanks in Advance for any kind of help to resolve this issue 

Regards

Original issue reported on code.google.com by m.khurra...@gmail.com on 31 Oct 2012 at 2:23

GoogleCodeExporter commented 9 years ago
What is in wsgi.py?

Try with a WGSI hello world script.

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#WSGI_Application_S
cript_File

If that works, then read:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_St
ate_API

and set WSGIApplicationGroup as described.

Original comment by Graham.Dumpleton@gmail.com on 31 Oct 2012 at 9:50

GoogleCodeExporter commented 9 years ago
Infact My WSGI file is for Hello World.

import sys

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)

    print >> sys.stderr, 'sys.prefix = %s' % repr(sys.prefix)
    print >> sys.stderr, 'sys.path = %s' % repr(sys.path)

    return [output]

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 6:41

GoogleCodeExporter commented 9 years ago
it seems like the problem is here
[Wed Oct 31 19:14:24 2012] [notice] Parent: child process exited with status 
3221225477 -- Restarting.

Thanks

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 6:47

GoogleCodeExporter commented 9 years ago
We need to go back and check fundamentals then.

Do you only have one Python installation on your system?

Was the Python installation installed for all users and not just the user that 
installed it?

What other Apache modules are you loading? Are you loading mod_php?

Original comment by Graham.Dumpleton@gmail.com on 1 Nov 2012 at 9:51

GoogleCodeExporter commented 9 years ago
Python 2.7 was installed on my machine, and Iwas using pre complied mod_wsgi.so
That was working fine with Apache2.2 and Django

Than I need to run Python 2.4 
So I un-installed 2.7 and installed 2.4 
Updated PATH variable to point to 2.4 
When I open command prompt and type Python, its loading python 2.4
and django also working from wihtin command prompt

Python was installed for all users

I am not using mod_php, below is the apache server signature incase it may be 
usefull 
Apache/2.2.10 (Win32) mod_wsgi/3.4 Python/2.4.3 Server at server Port 80

List of loaded modules

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule status_module modules/mod_status.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule wsgi_module modules/mod_wsgi.so

Thanks

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 10:03

GoogleCodeExporter commented 9 years ago
To be able to build Python extensions, including mod_wsgi, with Python 2.4 and 
have them work properly, you likely would need Visual Studio 2003.

I am guessing that Microsoft Visual Studio 8 is not that and is a newer 
compiler so probably cannot be used.

Original comment by Graham.Dumpleton@gmail.com on 1 Nov 2012 at 10:14

GoogleCodeExporter commented 9 years ago
Microsoft Visual Studio 8 is 2005 Version 
Where can I find Visual Studio 2003.
Do you have any download link

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 10:24

GoogleCodeExporter commented 9 years ago
I know of no where that the compiler itself can be download.

Best you might do is send an email to mod_wsgi mailing list to see if someone 
already has a precompiled mod_wsgi for Python 2.4, but don't like your chances 
of getting a response as no one uses Python 2.4 these days.

What package are you using that requires Python 2.4? I recollect there being 
something out there that requires such an old Python on Windows, but cant 
remember what it is.

Original comment by Graham.Dumpleton@gmail.com on 1 Nov 2012 at 10:32

GoogleCodeExporter commented 9 years ago
Actually our online server is with python 2.4.3
We were doing development using 2.7 and every time we upload it gives some 
problem due to version difference 

So we decided to downgrade our version on development machine to match the 
online machine 

I have googled "Parent: child process exited with status 3221225477 "
and alot of people have faced this issue for different reasons
It seems like a generic error by apache
Can we do any sort of debugging using WSGI or python to get more specific 
details of this error?

Thanks for your help

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 10:51

GoogleCodeExporter commented 9 years ago
Your online server is Windows and mod_wsgi still, or Linux?

Original comment by Graham.Dumpleton@gmail.com on 1 Nov 2012 at 10:56

GoogleCodeExporter commented 9 years ago
Online is Centos
When we try to to update Python, it breaks yum and create other problems

Local server is Windows XP

Thanks

Original comment by m.khurra...@gmail.com on 1 Nov 2012 at 10:57

GoogleCodeExporter commented 9 years ago
You may find it better to run Linux in a local VM under Windows as you may hit 
other problems in the differences between Windows and Linux.

Original comment by Graham.Dumpleton@gmail.com on 1 Nov 2012 at 10:59

GoogleCodeExporter commented 9 years ago
I am facing the same issue 
 I have installed Wamp2.1 with apache2.2.17 
i have downloaded mod_wsgi-3.4.ap22.win-amd64-py2.7.so and renamed it to 
mod_wsgi.so and  placed in the module folder 
Then wrote in httpd.conf "LoadModule wsgi_module modules/mod_wsgi.so" at the 
end of load module list 

create a file test.py
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]

Now the problem is browser is showing the code directly instead of output.

Any help is appreciated. soul.tarun@gmail.com 

Original comment by soul.ta...@gmail.com on 6 Feb 2013 at 7:21

GoogleCodeExporter commented 9 years ago
@soul.tarin: No you are not having the same issue. This issue was for Apache 
crashing, you simply haven't configured Apache correctly. Go read:

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

Next time please use the mailing list or other forum when you want help.

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Asking_Your_Questions

You certainly shouldn't be posting against an existing ticket for another users 
problem. Tickets are for reporting actual bugs, not for getting help in how to 
run it.

Original comment by Graham.Dumpleton@gmail.com on 7 Feb 2013 at 2:41

GoogleCodeExporter commented 9 years ago
Closing out old issue. Looks like was an isolated issues as never had a 
pandemic of other reports. Thus may have been related to environment.

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