aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/perl/ngx_http_perl_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-05-29 18:48:42 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-05-29 18:48:42 +0000
commit8f0c87f38476f9e6017989196f40ebb1e0bbee60 (patch)
tree30fe260ae1512b2df212c574ef9e5618c55b83b2 /src/http/modules/perl/ngx_http_perl_module.c
parent78c58934124977c36392bc0794e3d41837d4b0ee (diff)
downloadnginx-8f0c87f38476f9e6017989196f40ebb1e0bbee60.tar.gz
nginx-8f0c87f38476f9e6017989196f40ebb1e0bbee60.zip
PERL_SYS_TERM() should be called once on exit only, this fixes the message
panic: MUTEX_LOCK (22) [op.c:352]. BEGIN failed--compilation aborted. ... [alert] ... perl_parse() failed: 9 Scalars leaked: 2 on threaded perl during second reconfiguration. PERL_SYS_INIT() should be called once too.
Diffstat (limited to 'src/http/modules/perl/ngx_http_perl_module.c')
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index b11320dad..b8352f056 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -67,6 +67,8 @@ static char *ngx_http_perl_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void ngx_http_perl_cleanup_perl(void *data);
#endif
+static void ngx_http_perl_exit(ngx_cycle_t *cycle);
+
static ngx_command_t ngx_http_perl_commands[] = {
@@ -128,7 +130,7 @@ ngx_module_t ngx_http_perl_module = {
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
- NULL, /* exit master */
+ ngx_http_perl_exit, /* exit master */
NGX_MODULE_V1_PADDING
};
@@ -478,12 +480,13 @@ ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
#endif
- PERL_SYS_INIT(&ngx_argc, &ngx_argv);
+ if (nginx_stash == NULL) {
+ PERL_SYS_INIT(&ngx_argc, &ngx_argv);
+ }
pmcf->perl = ngx_http_perl_create_interpreter(cf, pmcf);
if (pmcf->perl == NULL) {
- PERL_SYS_TERM();
return NGX_CONF_ERROR;
}
@@ -788,8 +791,6 @@ ngx_http_perl_cleanup_perl(void *data)
(void) perl_destruct(perl);
perl_free(perl);
-
- PERL_SYS_TERM();
}
#endif
@@ -1001,3 +1002,10 @@ ngx_http_perl_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_OK;
}
+
+
+static void
+ngx_http_perl_exit(ngx_cycle_t *cycle)
+{
+ PERL_SYS_TERM();
+}