[mod_python] server shutdown [was] i beg...

Richard Lewis richardlewis at fastmail.co.uk
Fri Aug 18 06:26:27 EDT 2006


On Friday 18 August 2006 11:08, you wrote:
> On 18/08/2006, at 7:48 PM, Richard Lewis wrote:
> > I then use a cleanup() function to release those
> > database handles.
> >
> > The implication of this is that I will no longer be able to release
> > the
> > handles at server shutdown, yes?
>
> I think you miss what I have been saying. That it doesn't work now.
> If you
> were to put calls to apache.log_error() in your cleanup handler and
> shutdown
> Apache when it is handling a decent amount of traffic, you will probably
> find your cleanup functions aren't actually being called, or if they
> do, they
> might not exit and will hang at some point. What you are more likely
> to see
> in the Apache log is a series of SIGTERM signals being sent and then a
> SIGKILL signal which is forcibly killing off the process.
>
Yes, sorry. I did get that, and, yes, I have sometimes noticed SIGKILLs in my 
Apache error log and, yes, I had worked out from your last message that this 
was the cause of them. Really, I should have asked in the present, not future 
tense!

> In the greater scheme of things it shouldn't ultimately matter. This
> is because
> your database server is going to notice that the connections to it
> have been
> dropped and will cleanup the resources on its side anyway. It has to
> do this
> as there is nothing to say that Apache or any client process connecting
> to it will not simply crash without cleanly disconnecting. In other
> words, you
> will not get resource leaks. That things didn't get cleanup in the
> Apache child
> process doesn't matter as it has been killed anyway, with all its
> memory being
> released back to operating system.
>
So I suppose I'm worrying unnecessarily. I know MySQL doesn't care whether you 
call the Python bindings' close() function or not. But the Berkeley DB XML 
Python bindings /say/ that you should make sure that the close() function 
gets called before the connection object is destroyed. But, as you say, it 
won't cause connection leaks, so I suppose I should just not worry about it.

Cheers,
Richard
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
Sonic Arts Research Archive
http://www.sara.uea.ac.uk/
JID: ironchicken at jabber.earth.li
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


More information about the Mod_python mailing list