You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "uka mata (JIRA)" <ji...@apache.org> on 2006/09/05 12:43:22 UTC

[jira] Created: (MODPYTHON-188) Session object crash apache

Session object crash apache
---------------------------

                 Key: MODPYTHON-188
                 URL: http://issues.apache.org/jira/browse/MODPYTHON-188
             Project: mod_python
          Issue Type: Bug
          Components: session
    Affects Versions: 3.1.4
         Environment: Gentoo 2006.1 with Apache 2.0.58
Apache details:
# emerge -vp apache
[ebuild   R   ] net-www/apache-2.0.58-r2  USE="apache2 ssl threads -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker -no-suexec -static-modules" 0 kB

            Reporter: uka mata
            Priority: Trivial


Starting two times Session crash apache, example:

#!/usr/bin/python
# -*- coding: iso-8859-1 -*-

import sys
from mod_python import apache, util, Session

def index(req):
        req.content_type = "text/plain; charset=iso-8859-1"
        req.send_http_header()
        req.write("Hello world!\n")
        sess1=Session.Session(req)
        sess2=Session.Session(req)
        return "Bye bye!"


When I have reloaded this page several times, apache has stopped to send pages, and I cannot stop it using the init scripts and therefore I need to use "kill -9"

The log said:
[Tue Sep 05 11:42:45 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
[Tue Sep 05 11:42:47 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
[Tue Sep 05 11:42:49 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
[Tue Sep 05 11:42:51 2006] [error] child process 27269 still did not exit, sending a SIGKILL



Sometimes I have received this page:
Hello world!

<pre>
Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
    result = object(req)

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)

  File "/usr/lib/python2.4/site-packages/mod_python/util.py", line 361, in apply_fs_data
    return object(**args)

  File "/var/www/localhost/htdocs/index.py", line 11, in index
    sess1=Session.Session(req)

  File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 389, in Session
    timeout=timeout, lock=lock)

  File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 294, in __init__
    timeout=timeout, lock=lock)

  File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 131, in __init__
    self.lock()                 # lock new sid

  File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 215, in lock
    _apache._global_lock(self._req.server, self._sid)

ValueError: Failed to acquire global mutex lock

</pre>

## Stopping apache

solaris apache2 # /etc/init.d/apache2 stop
 * Stopping apache2 ...                                                                       [ ok ]
solaris apache2 # ps -A
  PID TTY          TIME CMD
[...]
27123 ?        00:00:00 apache2
27269 ?        00:00:00 apache2
27370 ?        00:00:00 apache2 <defunct>
27511 ?        00:00:00 apache2 <defunct>
27544 ?        00:00:00 apache2 <defunct>
27617 pts/1    00:00:00 ps
solaris apache2 #







-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MODPYTHON-188) Session object crash apache

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-188?page=all ]

Graham Dumpleton closed MODPYTHON-188.
--------------------------------------

    Resolution: Invalid

This is not a bug, the code in your example is simply wrong. You cannot write:

        sess1=Session.Session(req) 
        sess2=Session.Session(req) 

This is because in creating sess1 the lock is acquired for the session ID. When sess2 is then created, it deadlocks on itself because the lock for the session ID is already held.

The log messages:

[Tue Sep 05 11:42:45 2006] [warn] child process 27269 still did not exit, sending a SIGTERM 
[Tue Sep 05 11:42:47 2006] [warn] child process 27269 still did not exit, sending a SIGTERM 
[Tue Sep 05 11:42:49 2006] [warn] child process 27269 still did not exit, sending a SIGTERM 
[Tue Sep 05 11:42:51 2006] [error] child process 27269 still did not exit, sending a SIGKILL 

are because the child process was deadlocked and thus could not be shutdown properly and it had to be killed.


> Session object crash apache
> ---------------------------
>
>                 Key: MODPYTHON-188
>                 URL: http://issues.apache.org/jira/browse/MODPYTHON-188
>             Project: mod_python
>          Issue Type: Bug
>          Components: session
>    Affects Versions: 3.1.4
>         Environment: Gentoo 2006.1 with Apache 2.0.58
> Apache details:
> # emerge -vp apache
> [ebuild   R   ] net-www/apache-2.0.58-r2  USE="apache2 ssl threads -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker -no-suexec -static-modules" 0 kB
>            Reporter: Uka Mata
>            Priority: Trivial
>
> Starting two times Session crash apache, example:
> #!/usr/bin/python
> # -*- coding: iso-8859-1 -*-
> import sys
> from mod_python import apache, util, Session
> def index(req):
>         req.content_type = "text/plain; charset=iso-8859-1"
>         req.send_http_header()
>         req.write("Hello world!\n")
>         sess1=Session.Session(req)
>         sess2=Session.Session(req)
>         return "Bye bye!"
> When I have reloaded this page several times, apache has stopped to send pages, and I cannot stop it using the init scripts and therefore I need to use "kill -9"
> The log said:
> [Tue Sep 05 11:42:45 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
> [Tue Sep 05 11:42:47 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
> [Tue Sep 05 11:42:49 2006] [warn] child process 27269 still did not exit, sending a SIGTERM
> [Tue Sep 05 11:42:51 2006] [error] child process 27269 still did not exit, sending a SIGKILL
> Sometimes I have received this page:
> Hello world!
> <pre>
> Mod_python error: "PythonHandler mod_python.publisher"
> Traceback (most recent call last):
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
>     result = object(req)
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 136, in handler
>     result = util.apply_fs_data(object, req.form, req=req)
>   File "/usr/lib/python2.4/site-packages/mod_python/util.py", line 361, in apply_fs_data
>     return object(**args)
>   File "/var/www/localhost/htdocs/index.py", line 11, in index
>     sess1=Session.Session(req)
>   File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 389, in Session
>     timeout=timeout, lock=lock)
>   File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 294, in __init__
>     timeout=timeout, lock=lock)
>   File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 131, in __init__
>     self.lock()                 # lock new sid
>   File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 215, in lock
>     _apache._global_lock(self._req.server, self._sid)
> ValueError: Failed to acquire global mutex lock
> </pre>
> ## Stopping apache
> solaris apache2 # /etc/init.d/apache2 stop
>  * Stopping apache2 ...                                                                       [ ok ]
> solaris apache2 # ps -A
>   PID TTY          TIME CMD
> [...]
> 27123 ?        00:00:00 apache2
> 27269 ?        00:00:00 apache2
> 27370 ?        00:00:00 apache2 <defunct>
> 27511 ?        00:00:00 apache2 <defunct>
> 27544 ?        00:00:00 apache2 <defunct>
> 27617 pts/1    00:00:00 ps
> solaris apache2 #

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira