Mercurial > hg > nginx
comparison src/http/modules/perl/ngx_http_perl_module.c @ 2715:a5845475a903
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
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 16 Apr 2009 14:42:31 +0000 |
parents | 4dd1773990db |
children | 8e720b7fe6d2 |
comparison
equal
deleted
inserted
replaced
2714:4dd1773990db | 2715:a5845475a903 |
---|---|
152 }; | 152 }; |
153 | 153 |
154 #endif | 154 #endif |
155 | 155 |
156 | 156 |
157 static ngx_str_t ngx_null_name = ngx_null_string; | 157 static ngx_str_t ngx_null_name = ngx_null_string; |
158 | 158 |
159 | 159 static HV *nginx_stash; |
160 static HV *nginx_stash; | 160 |
161 #if (NGX_HAVE_PERL_MULTIPLICITY) | |
162 static ngx_uint_t ngx_perl_term; | |
163 #endif | |
164 | |
161 | 165 |
162 static void | 166 static void |
163 ngx_http_perl_xs_init(pTHX) | 167 ngx_http_perl_xs_init(pTHX) |
164 { | 168 { |
165 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); | 169 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); |
819 PERL_SET_CONTEXT(perl); | 823 PERL_SET_CONTEXT(perl); |
820 | 824 |
821 (void) perl_destruct(perl); | 825 (void) perl_destruct(perl); |
822 | 826 |
823 perl_free(perl); | 827 perl_free(perl); |
828 | |
829 if (ngx_perl_term) { | |
830 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, "perl term"); | |
831 | |
832 PERL_SYS_TERM(); | |
833 } | |
824 } | 834 } |
825 | 835 |
826 #endif | 836 #endif |
827 | 837 |
828 | 838 |
1055 | 1065 |
1056 | 1066 |
1057 static void | 1067 static void |
1058 ngx_http_perl_exit(ngx_cycle_t *cycle) | 1068 ngx_http_perl_exit(ngx_cycle_t *cycle) |
1059 { | 1069 { |
1070 #if (NGX_HAVE_PERL_MULTIPLICITY) | |
1071 | |
1072 ngx_perl_term = 1; | |
1073 | |
1074 #else | |
1060 ngx_http_perl_main_conf_t *pmcf; | 1075 ngx_http_perl_main_conf_t *pmcf; |
1061 | 1076 |
1062 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); | 1077 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); |
1063 | 1078 |
1064 if (pmcf) { | 1079 if (pmcf && nginx_stash) { |
1065 dTHXa(pmcf->perl); | 1080 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term"); |
1066 PERL_SET_CONTEXT(pmcf->perl); | 1081 |
1082 (void) perl_destruct(pmcf->perl); | |
1083 | |
1084 perl_free(pmcf->perl); | |
1067 | 1085 |
1068 PERL_SYS_TERM(); | 1086 PERL_SYS_TERM(); |
1069 } | 1087 } |
1070 } | 1088 |
1089 #endif | |
1090 } |