diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2014-11-11 12:51:50 +0000 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2014-11-11 13:09:05 +0000 |
commit | 1dcdb720541c66fe9c359627f0b0433706ac11eb (patch) | |
tree | f2ad7d38f110bf0ae256aaf18e840ee81003fa51 /t | |
parent | 7ef33950c5fbf07eb1b8b9ac369a17adfd4ca424 (diff) | |
download | uwsgi-1dcdb720541c66fe9c359627f0b0433706ac11eb.tar.gz |
psgi: Move the destruction of the perl interpreter to the atexit hook + more bugfixes
My previous commit ensured that we called the DESTROY hook but we
wouldn't properly call the atexit hook. Now when you start uWSGI as
instructed in that commit you'll get this:
* localhost:1234?0:
$$: Calling DESTROY
* localhost:1234?1:
*** psgix.harakiri.commit requested ***
...The work of process 523 is done. Seeya!
523: Calling the atexit hook
523: Calling DESTROY
* Ctrl+C (or stop):
^CSIGINT/SIGQUIT received...killing workers...
696: Calling the atexit hook
Before this change we wouldn't call the atexit hook when
psgix.harakiri.commit was requested by calling localhost:1234?1.
To make this work I removed the "if busy do not run atexit hooks"
condition added in 1.4-rc2-246-g499202e. Of course uWSGI is going to
think the worker is "busy", it's busy being destroyed, that doesn't mean
we should skip running the atexit hooks.
We'll still skip them under the "if hijacked do not run atexit hooks"
condition added in that commit, and the "managing atexit in async mode
is a real pain" condition added in 1.0.1-289-gd7e8523. Maybe those are
further bugs that need to be solved, but I don't know how to test those
modes.
Now we'll also call PERL_SET_CONTEXT() and PERL_SYS_TERM() appropriately
during destruction. Note that the latter should only be called once even
if you have multiple interpreters.
Diffstat (limited to 't')
-rw-r--r-- | t/perl/test_harakiri.psgi | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/perl/test_harakiri.psgi b/t/perl/test_harakiri.psgi index 7680944a..35a40dbf 100644 --- a/t/perl/test_harakiri.psgi +++ b/t/perl/test_harakiri.psgi @@ -6,6 +6,12 @@ use warnings; sub DESTROY { print STDERR "$$: Calling DESTROY\n" } } +uwsgi::atexit( + sub { + print STDERR "$$: Calling the atexit hook\n"; + } +); + sub { my $env = shift; |