mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 11:38:36 +08:00
perl termination fixes:
*) master exit hook is run before global pool cleanup, so call PERL_SYS_TERM() after perl_destruct()/perl_free(). This fixes the message panic: MUTEX_LOCK (22) [op.c:352] on some threaded perl builds *) call perl_destruct()/perl_free() before PERL_SYS_TERM() for non-mulitiplicity perl
This commit is contained in:
parent
e4ecddfdb0
commit
c26e7b9d49
@ -156,9 +156,13 @@ static ngx_http_ssi_command_t ngx_http_perl_ssi_command = {
|
|||||||
|
|
||||||
static ngx_str_t ngx_null_name = ngx_null_string;
|
static ngx_str_t ngx_null_name = ngx_null_string;
|
||||||
|
|
||||||
|
|
||||||
static HV *nginx_stash;
|
static HV *nginx_stash;
|
||||||
|
|
||||||
|
#if (NGX_HAVE_PERL_MULTIPLICITY)
|
||||||
|
static ngx_uint_t ngx_perl_term;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ngx_http_perl_xs_init(pTHX)
|
ngx_http_perl_xs_init(pTHX)
|
||||||
{
|
{
|
||||||
@ -821,6 +825,12 @@ ngx_http_perl_cleanup_perl(void *data)
|
|||||||
(void) perl_destruct(perl);
|
(void) perl_destruct(perl);
|
||||||
|
|
||||||
perl_free(perl);
|
perl_free(perl);
|
||||||
|
|
||||||
|
if (ngx_perl_term) {
|
||||||
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, "perl term");
|
||||||
|
|
||||||
|
PERL_SYS_TERM();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -1057,14 +1067,24 @@ ngx_http_perl_init_worker(ngx_cycle_t *cycle)
|
|||||||
static void
|
static void
|
||||||
ngx_http_perl_exit(ngx_cycle_t *cycle)
|
ngx_http_perl_exit(ngx_cycle_t *cycle)
|
||||||
{
|
{
|
||||||
|
#if (NGX_HAVE_PERL_MULTIPLICITY)
|
||||||
|
|
||||||
|
ngx_perl_term = 1;
|
||||||
|
|
||||||
|
#else
|
||||||
ngx_http_perl_main_conf_t *pmcf;
|
ngx_http_perl_main_conf_t *pmcf;
|
||||||
|
|
||||||
pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
|
pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
|
||||||
|
|
||||||
if (pmcf) {
|
if (pmcf && nginx_stash) {
|
||||||
dTHXa(pmcf->perl);
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term");
|
||||||
PERL_SET_CONTEXT(pmcf->perl);
|
|
||||||
|
(void) perl_destruct(pmcf->perl);
|
||||||
|
|
||||||
|
perl_free(pmcf->perl);
|
||||||
|
|
||||||
PERL_SYS_TERM();
|
PERL_SYS_TERM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user