On Mon, Jan 25, 2010 at 4:08 PM, Graham Dumpleton
<[email protected]> wrote:
> 2010/1/26 Peter Kropf <[email protected]>:
>> I'm trying to get mod_wsgi running on my OS X development system for
>> use with a Django application and I'm running into a problem when
>> using WSGIDaemonProcess. I'm running apache 2.2.14 from mac ports and
>> mod_wsgi 3.1 from the source code distribution.
>>
>> If I follow the example from 
>> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide,
>> all is right with the world. When I add the WSGIDaemonProcess (and
>> WSGIProcessGroup) the example still works fine.
>>
>> When I create an empty Django application via django-admin-2.6.py and
>> I run it with the example .wsgi file from
>> http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango w/o the
>> WSGIDaemonProcess directive, it works just fine. However, when I add
>> the WSGIDaemonProcess directive and try to access the page, I receive
>> a 500 internal server error and the apache error log shows:
>>
>> [Mon Jan 25 15:23:07 2010] [info] [client ::1] mod_wsgi (pid=88975,
>> process='dev', application='fog|/wsgi/mysite'): Loading WSGI script '/
>> Users/peter/stuff/wsgi/mysite/apache/mysite.wsgi'.
>> [Mon Jan 25 15:23:08 2010] [info] mod_wsgi (pid=88985): Initializing
>> Python.
>> [Mon Jan 25 15:23:08 2010] [info] mod_wsgi (pid=88985): Attach
>> interpreter ''.
>> [Mon Jan 25 15:23:08 2010] [error] [client ::1] Premature end of
>> script headers: mysite.wsgi
>> [Mon Jan 25 15:23:08 2010] [error] [client ::1] File does not exist: /
>> opt/local/apache2/htdocs/favicon.ico, referer: http://localhost/wsgi/mysite
>> [Mon Jan 25 15:23:09 2010] [notice] child pid 88975 exit signal Trace/
>> BPT trap (5)
>> [Mon Jan 25 15:23:09 2010] [info] mod_wsgi (pid=88975): Process 'dev'
>> has died, restarting.
>>
>>
>> My httpd.conf file is:
>>
>> ServerRoot "/opt/local/apache2"
>> Listen 80
>>
>> LoadModule authn_file_module modules/mod_authn_file.so
>> LoadModule authn_dbm_module modules/mod_authn_dbm.so
>> LoadModule authn_anon_module modules/mod_authn_anon.so
>> LoadModule authn_dbd_module modules/mod_authn_dbd.so
>> LoadModule authn_default_module modules/mod_authn_default.so
>> LoadModule authz_host_module modules/mod_authz_host.so
>> LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
>> LoadModule authz_user_module modules/mod_authz_user.so
>> LoadModule authz_dbm_module modules/mod_authz_dbm.so
>> LoadModule authz_owner_module modules/mod_authz_owner.so
>> LoadModule authz_default_module modules/mod_authz_default.so
>> LoadModule auth_basic_module modules/mod_auth_basic.so
>> LoadModule auth_digest_module modules/mod_auth_digest.so
>> LoadModule file_cache_module modules/mod_file_cache.so
>> LoadModule cache_module modules/mod_cache.so
>> LoadModule disk_cache_module modules/mod_disk_cache.so
>> LoadModule mem_cache_module modules/mod_mem_cache.so
>> LoadModule dbd_module modules/mod_dbd.so
>> LoadModule dumpio_module modules/mod_dumpio.so
>> LoadModule ext_filter_module modules/mod_ext_filter.so
>> LoadModule include_module modules/mod_include.so
>> LoadModule filter_module modules/mod_filter.so
>> LoadModule substitute_module modules/mod_substitute.so
>> LoadModule deflate_module modules/mod_deflate.so
>> LoadModule log_config_module modules/mod_log_config.so
>> LoadModule log_forensic_module modules/mod_log_forensic.so
>> LoadModule logio_module modules/mod_logio.so
>> LoadModule env_module modules/mod_env.so
>> LoadModule mime_magic_module modules/mod_mime_magic.so
>> LoadModule cern_meta_module modules/mod_cern_meta.so
>> LoadModule expires_module modules/mod_expires.so
>> LoadModule headers_module modules/mod_headers.so
>> LoadModule ident_module modules/mod_ident.so
>> LoadModule usertrack_module modules/mod_usertrack.so
>> LoadModule unique_id_module modules/mod_unique_id.so
>> LoadModule setenvif_module modules/mod_setenvif.so
>> LoadModule version_module modules/mod_version.so
>> LoadModule proxy_module modules/mod_proxy.so
>> LoadModule proxy_connect_module modules/mod_proxy_connect.so
>> LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
>> LoadModule proxy_http_module modules/mod_proxy_http.so
>> LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
>> LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
>> LoadModule ssl_module modules/mod_ssl.so
>> LoadModule mime_module modules/mod_mime.so
>> LoadModule dav_module modules/mod_dav.so
>> LoadModule status_module modules/mod_status.so
>> LoadModule autoindex_module modules/mod_autoindex.so
>> LoadModule asis_module modules/mod_asis.so
>> LoadModule info_module modules/mod_info.so
>> LoadModule cgi_module modules/mod_cgi.so
>> LoadModule dav_fs_module modules/mod_dav_fs.so
>> LoadModule vhost_alias_module modules/mod_vhost_alias.so
>> LoadModule negotiation_module modules/mod_negotiation.so
>> LoadModule dir_module modules/mod_dir.so
>> LoadModule imagemap_module modules/mod_imagemap.so
>> LoadModule actions_module modules/mod_actions.so
>> LoadModule speling_module modules/mod_speling.so
>> LoadModule userdir_module modules/mod_userdir.so
>> LoadModule alias_module modules/mod_alias.so
>> LoadModule rewrite_module modules/mod_rewrite.so
>> LoadModule php5_module        modules/libphp5.so
>> LoadModule wsgi_module modules/mod_wsgi.so
>>
>> <IfModule !mpm_netware_module>
>> <IfModule !mpm_winnt_module>
>> User www-data
>> Group www-data
>>
>> </IfModule>
>> </IfModule>
>>
>> ServerAdmin [email protected]
>>
>> DocumentRoot "/opt/local/apache2/htdocs"
>>
>> <Directory />
>>    Options FollowSymLinks
>>    AllowOverride None
>>    Order deny,allow
>>    Deny from all
>> </Directory>
>>
>> <Directory "/opt/local/apache2/htdocs">
>>    Options Indexes FollowSymLinks
>>
>>    AllowOverride None
>>
>>    Order allow,deny
>>    Allow from all
>>
>> </Directory>
>>
>> <IfModule dir_module>
>>    DirectoryIndex index.html
>> </IfModule>
>>
>> <Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
>>    Order allow,deny
>>    Deny from all
>>    Satisfy All
>> </Files>
>>
>> <Files "rsrc">
>>    Order allow,deny
>>    Deny from all
>>    Satisfy All
>> </Files>
>>
>> <Directory  ~ ".\.\.namedfork">
>>    Order allow,deny
>>    Deny from all
>>    Satisfy All
>> </Directory>
>>
>> ErrorLog "logs/error_log"
>>
>> LogLevel info
>>
>> <IfModule log_config_module>
>>    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-
>> Agent}i\"" combined
>>    LogFormat "%h %l %u %t \"%r\" %>s %b" common
>>
>>    <IfModule logio_module>
>>      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-
>> Agent}i\" %I %O" combinedio
>>    </IfModule>
>>
>>    CustomLog "logs/access_log" common
>> </IfModule>
>>
>> <IfModule alias_module>
>>    ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
>> </IfModule>
>>
>> <IfModule cgid_module>
>> </IfModule>
>>
>> <Directory "/opt/local/apache2/cgi-bin">
>>    AllowOverride None
>>    Options None
>>    Order allow,deny
>>    Allow from all
>> </Directory>
>>
>> DefaultType text/plain
>>
>> <IfModule mime_module>
>>    TypesConfig conf/mime.types
>>    AddType application/x-compress .Z
>>    AddType application/x-gzip .gz .tgz
>> </IfModule>
>>
>> <IfModule ssl_module>
>> SSLRandomSeed startup builtin
>> SSLRandomSeed connect builtin
>> </IfModule>
>>
>> ExtendedStatus On
>>
>> <Location /server-status>
>>  SetHandler server-status
>>  Order allow,deny
>>  Allow from localhost
>> </Location>
>>
>> Alias /media /opt/local/Library/Frameworks/Python.framework/Versions/
>> 2.6/lib/python2.6/site-packages/django/contrib/admin/media
>>
>> <Directory /opt/local/Library/Frameworks/Python.framework/Versions/2.6/
>> lib/python2.6/site-packages/django/contrib/admin/media>
>>    Order allow,deny
>>    Allow from all
>> </Directory>
>>
>> Alias /site_media /Users/peter/TheCrucible/svn/tools/media
>>
>> <Directory /Users/peter/TheCrucible/svn/tools/media>
>>    Order allow,deny
>>    Allow from all
>> </Directory>
>>
>> WSGIDaemonProcess dev user=peter group=staff processes=5 threads=1
>>
>> WSGIScriptAlias /wsgi/test /Users/peter/stuff/wsgi/test/app.wsgi
>>
>> <Directory /Users/peter/stuff/wsgi/test>
>>    WSGIProcessGroup dev
>>    order allow,deny
>>    allow from all
>> </Directory>
>>
>> WSGIScriptAlias /wsgi/mysite /Users/peter/stuff/wsgi/mysite/apache/
>> mysite.wsgi
>>
>> <Directory /Users/peter/stuff/wsgi/mysite/apache>
>>    WSGIProcessGroup dev
>>    order allow,deny
>>    allow from all
>> </Directory>
>>
>>
>> Any suggestions on where to look for an answer?
>
> Are you using Python as supplied by Apple or from elsewhere?

I've tried configuring mod_wsgi w/ both
--with-python=/opt/local/bin/python2.6 and
--with-python=/usr/bin/python2.6. I get the same results either way.


> Since the problem is due to daemon process crashing, the quickest
> thing to do is work out where. That may then save round about path of
> suggesting all the possibilities.
>
> So, following instructions in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB
>
> for using gdb to capture stack trace for crash of daemon mode process.
>
> That is, use default of single process as provided by
> WSGIDaemonProcess, use logs to identify the process ID easily. Need to
> set LogLevel to 'info' in Apache to get that information. Attach gdb
> to that process ID and then trigger request. Use gdb to get stack
> trace for all threads.
>
> Various of the reasons for crashes re described in:
>
>  http://code.google.com/p/modwsgi/wiki/ApplicationIssues
>
> It is a bit odd that you would get it for empty Django installation.
> Although that depends a bit on which Python installation is being
> used.

I ran apache under gdb. Here's the traceback:

Program received signal EXC_SOFTWARE, Software generated exception.
0x96468bfe in read$UNIX2003 ()
(gdb)
(gdb) bt
#0  0x96468bfe in read$UNIX2003 ()
#1  0x002f5d78 in apr_file_read ()
#2  0x0009a772 in pipe_bucket_read ()
#3  0x0000ec4c in getsfunc_BRIGADE ()
#4  0x0000fa61 in ap_scan_script_header_err_core ()
#5  0x00010120 in ap_scan_script_header_err_brigade ()
#6  0x01704114 in wsgi_hook_handler ()
#7  0x000026cb in ap_run_handler ()
#8  0x00004707 in ap_invoke_handler ()
#9  0x000290fe in ap_process_request ()
#10 0x00025878 in ap_process_http_connection ()
#11 0x00010eab in ap_run_process_connection ()
#12 0x0002e3d6 in child_main ()
#13 0x0002e64a in make_child ()
#14 0x0002f55c in ap_mpm_run ()
#15 0x0000992d in main ()
(gdb)


- Peter

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to