Created: (MODPYTHON-109) Signal handler calling
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Created: (MODPYTHON-109) Signal handler calling




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Created: (MODPYTHON-109) Signal handler calling  
Graham Dumpleton (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-07-06 12:46 PM

Signal handler calling Py_Finalize() when child processes being killed.
-----------------------------------------------------------------------

Key: MODPYTHON-109
URL: http://issues.apache.org/jira/browse/MODPYTHON-109
Project: mod_python
Type: Bug
Components: core
Versions: 3.2
Reporter: Graham Dumpleton


When Apache is killing off child processes as part of actions taken when the
 "apachectl restart" or "apachectl graceful" command is run, it sends a SIGT
ERM signal to the child processes. This causes a signal handler registered b
y Apache to be run. That si
gnal handler destroys the main child memory pool. That memory pool has thoug
h a cleanup handler associated with it which was registered by mod_python. T
hat cleanup handler ultimately calls Py_Finalize().

The problem with this is that Py_Finalize() isn't safe to be called from a s
ignal handler and if a handler is still executing or there is a separate thr
ead running in the context of Python, a deadlock will likely ensue. This wil
l prevent the child process
exiting due to the SIGTERM causing the Apache parent process to send it a SI
GKILL to really kill it.

For a more detailed assessment of the problem and what lead to this conclusi
on see:

http://www.modpython.org/pipermail/...ary/019865.html
http://www.modpython.org/pipermail/...ary/019866.html
http://www.modpython.org/pipermail/...ary/019870.html

To avoid the problem, the only choice seems to be avoid calling Py_Finalize(
) from the signal handler. The simplistic way of doing this seems to be to a
dd:

if (child_init_pool)
return APR_SUCCESS;

at the start of python_finalize(). This will mean that Py_Finalize() is neve
r called in child processes. The full consequences of this is unknown, but o
n face value it would seem that it might be a reasonable thing to do. More r
esearch may be required.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:32 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register