On 14 January 2013 17:18, Roberto De Ioris <[email protected]> wrote:
>
>> Hi,
>>
>> We at $work are using uWSGI with Perl. We would like to trigger
>> certain cleanup actions when a worker is terminated.
>>
>> My first thought was to intercept $SIG{TERM}/$SIG{INT}/$SIG{QUIT} as
>> necessary, however experiments to make this work suggest that uWSGI
>> intercepts these signals, and does not allow the worker process to
>> handle them itself.
>>
>> How can we ensure that cleanup processes are correctly run at termination?
>>
>> Is it possible to register a pre-teardown handler somehow?
>>
>> I have experience hacking perl internals, I would be open to
>> investigating improvements in this area given some guidance.
>>
>> Yves
>> ps: Please forgive any lack of RTFM, I am new to uWSGI and still
>> getting up to speed.
>>
>> --
>> perl -Mre=debug -e "/just|another|perl|hacker/"
>> _______________________________________________
>> uWSGI mailing list
>> [email protected]
>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>
>
> You can try with the AtExit module
>
> http://search.cpan.org/~bradapp/AtExit-2.01/AtExit.pm
>
> now i am not able to test it, but eventually fixing the psgi plugin for it
> should be pretty easy.

As far as I can tell this solution will have the same problem. END{}
blocks are not executed due to a termination triggered by a signal.

<quote>
It is important to note that END{} blocks and object destruction only
get called on normal termination (which includes calls to die or
Carp::croak). They do not get called when the program terminates
abnormally (due to a signal for example) unless special arrangements
have been made by the programmer (e.g. using a signal handler -- see
"%SIG{expr}" in perlvar).
</quote>

Since uWSGI seems to not support passing such signals to the worker
process it seems to me that we are back to the same problem.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to