The very minimal Apache configuration they supply is somehow resulting in
Apache not being initialised properly in some way that mod_wsgi expects. Or
more likely the changes I made have simply changed the memory layout enough
that it works.
If I use:
Listen 8080
LogLevel warn
WSGIDaemonProcess example.com processes=2 threads=2
<VirtualHost *:8080>
ServerName localhost
WSGIScriptAlias /test /wsgi/wsgi-test.wsgi
WSGIProcessGroup example.com
<Directory /wsgi>
Require all granted
</Directory>
</VirtualHost>
then it works fine.
The two changes were, set LogLevel directive to have a value rather than rely
on compiled in default.
Move the WSGIDaemonProcess directive outside of the VirtualHost.
As long as do both, it isn’t crashing.
I have suspected that there is a memory usage issue in mod_wsgi for a very long
time and have never been able to find it.
I have seen two different issues and both only occur with Apache from MacOS X
on Yosemite.
The first is that if use -DFOREGROUND and -DONE_PROCESS it would crash on
startup.
The second is that sometimes on shutdown with mod_wsgi-express, the Python
interpreter will crash as it being destroyed within the process.
Whenever I have attempted to stick a debugger on it to try and track down, the
issue never occurs.
BTW, with the mod_wsgi-express way of triggering it, can you instead run:
mod_wsgi-express start-server /wsgi/wsgi-test.wsgi —user apache —group
apache —enable-gdb
This will launch httpd under gdb from the outset, in the -DFOREGROUND and
-DONE_PROCESS mode. I want to see if in doing that it still crashes.
Graham
> On 30 Sep 2016, at 1:57 AM, Konstantin Suvorov <[email protected]> wrote:
>
> I've tried mod_wsgi-express on a clean python:2.7-apline image.
> Just made:
> apk --no-cache add build-base bash
> pip install mod_wsgi-httpd
> pip install mod_wsgi
> addgroup -S apache
> adduser -S -G apache apache
> mod_wsgi-express start-server /wsgi/wsgi-test.wsgi --user apache --group
> apache
> Gives segfault with hello world application.
>
> Some GDB stuff:
> (gdb) r
> Starting program: /bin/bash -c mod_wsgi-express\ start-server\
> /wsgi/wsgi-test.wsgi\ --user\ apache\ --group\ apache
> process 1667 is executing new program: /usr/local/bin/python2.7
> Server URL : http://localhost:8000/
> Server Root : /tmp/mod_wsgi-localhost:8000:0
> Server Conf : /tmp/mod_wsgi-localhost:8000:0/httpd.conf
> Error Log File : /tmp/mod_wsgi-localhost:8000:0/error_log (warn)
> Request Capacity : 5 (1 process * 5 threads)
> Request Timeout : 60 (seconds)
> Startup Timeout : 15 (seconds)
> Queue Backlog : 100 (connections)
> Queue Timeout : 45 (seconds)
> Server Capacity : 20 (event/worker), 20 (prefork)
> Server Backlog : 500 (connections)
> Locale Setting : en_US.UTF-8
> process 1667 is executing new program: /bin/busybox
> process 1667 is executing new program: /bin/bash
> process 1667 is executing new program:
> /usr/local/lib/python2.7/site-packages/mod_wsgi_packages/httpd/bin/httpd
>
> Program received signal SIGSEGV, Segmentation fault.
> wsgi_add_daemon_process (cmd=0x7fffffffe800, mconfig=<optimized out>,
> args=0x55555583eefd "") at src/server/mod_wsgi.c:7569
> 7569 src/server/mod_wsgi.c: No such file or directory.
> (gdb) bt
> #0 wsgi_add_daemon_process (cmd=0x7fffffffe800, mconfig=<optimized out>,
> args=0x55555583eefd "") at src/server/mod_wsgi.c:7569
> #1 0x00005555555a2776 in invoke_cmd (cmd=0x7ffff567d8d0 <wsgi_commands+80>,
> parms=parms@entry=0x7fffffffe800, mconfig=0x555555839e38,
> args=0x55555583ecc8 "localhost:8000
> display-name='(wsgi:localhost:8000:0)' home='/' threads=5
> maximum-requests=0 python-path=''
> python-eggs='/tmp/mod_wsgi-localhost:8000:0/python-eggs'
> lang='en_US.UTF"...) at config.c:879
> #2 0x00005555555a4f1d in ap_walk_config_sub (section_vector=0x55555581e508,
> parms=0x7fffffffe800, current=0x55555583aa88) at config.c:1309
> #3 ap_walk_config (current=0x55555583aa88, parms=parms@entry=0x7fffffffe800,
> section_vector=0x55555581e508) at config.c:1342
> #4 0x00005555555a622d in ap_process_config_tree (s=<optimized out>,
> conftree=<optimized out>, p=0x5555557ec0a8, ptemp=<optimized out>)
> at config.c:2059
> #5 0x0000555555582d5d in main (argc=10, argv=0x7fffffffe9b8) at main.c:739
>
> This leads me to this
> <https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/src/server/mod_wsgi.c#L7569>:
> if (!strcmp(entry->name, name))
> return "Name duplicates previous WSGI daemon definition.";
>
> gdb output from packaged apache and mod_wsgi suggest the same place:
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff7dc1abd in strcmp () from /lib/ld-musl-x86_64.so.1
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.