Apache Mod-Python - Updated: (MODPYTHON-109) Signal handler calling

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > August 2006 > Updated: (MODPYTHON-109) Signal handler calling





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

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

2006-08-13, 7:12 am

[ http://issues.apache.org/jira/brows...ON-109?page=all ]

Graham Dumpleton updated MODPYTHON-109:
---------------------------------------

Fix Version/s: 3.3

Mark to be addressed in 3.3. Specifically, unless good reasons are found not to, the apache.register_cleanup() and req.server.register_cleanup() methods will be deprecated and implementations stubbed out to log a message to Apache error log indicate they
are no longer supported. The current code is just too unreliable, can't be guaranteed to run and causes problems in shutdown of Apache child processes.

> 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
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.7
> Reporter: Graham Dumpleton
> Assigned To: Graham Dumpleton
> Fix For: 3.3
>
> Attachments: MP109_20060308_grahamd_1.diff
>
>
> 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 SIGTERM signal to the child processes. This causes a signal handler registered by Apache to be run. That

signal handler destroys the main child memory pool. That memory pool has though a cleanup handler associated with it which was registered by mod_python. That cleanup handler ultimately calls Py_Finalize().
> The problem with this is that Py_Finalize() isn't safe to be called from a signal handler and if a handler is still executing or there is a separate thread running in the context of Python, a deadlock will likely ensue. This will prevent the child proce

ss exiting due to the SIGTERM causing the Apache parent process to send it a SIGKILL to really kill it.
> For a more detailed assessment of the problem and what lead to this conclusion 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 add:
> if (child_init_pool)
> return APR_SUCCESS;
> at the start of python_finalize(). This will mean that Py_Finalize() is never called in child processes. The full consequences of this is unknown, but on face value it would seem that it might be a reasonable thing to do. More research may be required.



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com