Mercurial > hg > nginx-vendor-0-8
comparison src/os/unix/ngx_process_cycle.c @ 122:d25a1d6034f1 NGINX_0_3_8
nginx 0.3.8
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; bug appeared
in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 09 Nov 2005 00:00:00 +0300 |
parents | e85dca77c46a |
children | df17fbafec8f |
comparison
equal
deleted
inserted
replaced
121:737953b238a4 | 122:d25a1d6034f1 |
---|---|
13 static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, | 13 static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, |
14 ngx_int_t type); | 14 ngx_int_t type); |
15 static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type); | 15 static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type); |
16 static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo); | 16 static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo); |
17 static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle); | 17 static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle); |
18 static void ngx_master_exit(ngx_cycle_t *cycle); | 18 static void ngx_master_process_exit(ngx_cycle_t *cycle); |
19 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); | 19 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); |
20 static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority); | 20 static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority); |
21 static void ngx_worker_process_exit(ngx_cycle_t *cycle); | |
21 static void ngx_channel_handler(ngx_event_t *ev); | 22 static void ngx_channel_handler(ngx_event_t *ev); |
22 #if (NGX_THREADS) | 23 #if (NGX_THREADS) |
23 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle); | 24 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle); |
24 static ngx_thread_value_t ngx_worker_thread_cycle(void *data); | 25 static ngx_thread_value_t ngx_worker_thread_cycle(void *data); |
25 #endif | 26 #endif |
154 | 155 |
155 live = ngx_reap_childs(cycle); | 156 live = ngx_reap_childs(cycle); |
156 } | 157 } |
157 | 158 |
158 if (!live && (ngx_terminate || ngx_quit)) { | 159 if (!live && (ngx_terminate || ngx_quit)) { |
159 ngx_master_exit(cycle); | 160 ngx_master_process_exit(cycle); |
160 } | 161 } |
161 | 162 |
162 if (ngx_terminate) { | 163 if (ngx_terminate) { |
163 if (delay == 0) { | 164 if (delay == 0) { |
164 delay = 50; | 165 delay = 50; |
281 if (ngx_modules[i]->exit_process) { | 282 if (ngx_modules[i]->exit_process) { |
282 ngx_modules[i]->exit_process(cycle); | 283 ngx_modules[i]->exit_process(cycle); |
283 } | 284 } |
284 } | 285 } |
285 | 286 |
286 ngx_master_exit(cycle); | 287 ngx_master_process_exit(cycle); |
287 } | 288 } |
288 | 289 |
289 if (ngx_reconfigure) { | 290 if (ngx_reconfigure) { |
290 ngx_reconfigure = 0; | 291 ngx_reconfigure = 0; |
291 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring"); | 292 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring"); |
626 return live; | 627 return live; |
627 } | 628 } |
628 | 629 |
629 | 630 |
630 static void | 631 static void |
631 ngx_master_exit(ngx_cycle_t *cycle) | 632 ngx_master_process_exit(ngx_cycle_t *cycle) |
632 { | 633 { |
633 ngx_uint_t i; | 634 ngx_uint_t i; |
634 | 635 |
635 ngx_delete_pidfile(cycle); | 636 ngx_delete_pidfile(cycle); |
636 | 637 |
656 | 657 |
657 | 658 |
658 static void | 659 static void |
659 ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) | 660 ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) |
660 { | 661 { |
661 ngx_uint_t i; | |
662 ngx_connection_t *c; | |
663 #if (NGX_THREADS) | 662 #if (NGX_THREADS) |
664 ngx_int_t n; | 663 ngx_int_t n; |
665 ngx_err_t err; | 664 ngx_err_t err; |
666 ngx_core_conf_t *ccf; | 665 ngx_core_conf_t *ccf; |
667 #endif | 666 #endif |
715 if (ngx_exiting | 714 if (ngx_exiting |
716 && ngx_event_timer_rbtree.root == ngx_event_timer_rbtree.sentinel) | 715 && ngx_event_timer_rbtree.root == ngx_event_timer_rbtree.sentinel) |
717 { | 716 { |
718 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); | 717 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); |
719 | 718 |
720 | 719 ngx_worker_process_exit(cycle); |
721 #if (NGX_THREADS) | |
722 ngx_terminate = 1; | |
723 | |
724 ngx_wakeup_worker_threads(cycle); | |
725 #endif | |
726 | |
727 if (ngx_debug_quit) { | |
728 ngx_debug_point(); | |
729 } | |
730 | |
731 /* | |
732 * we do not destroy cycle->pool here because a signal handler | |
733 * that uses cycle->log can be called at this point | |
734 */ | |
735 | |
736 #if 0 | |
737 ngx_destroy_pool(cycle->pool); | |
738 #endif | |
739 exit(0); | |
740 } | 720 } |
741 | 721 |
742 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); | 722 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); |
743 | 723 |
744 ngx_process_events_and_timers(cycle); | 724 ngx_process_events_and_timers(cycle); |
745 | 725 |
746 if (ngx_terminate) { | 726 if (ngx_terminate) { |
747 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); | 727 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); |
748 | 728 |
749 #if (NGX_THREADS) | 729 ngx_worker_process_exit(cycle); |
750 ngx_wakeup_worker_threads(cycle); | |
751 #endif | |
752 | |
753 for (i = 0; ngx_modules[i]; i++) { | |
754 if (ngx_modules[i]->exit_process) { | |
755 ngx_modules[i]->exit_process(cycle); | |
756 } | |
757 } | |
758 | |
759 c = cycle->connections; | |
760 for (i = 0; i < cycle->connection_n; i++) { | |
761 if (c[i].fd != -1 | |
762 && c[i].read | |
763 && !c[i].read->accept | |
764 && !c[i].read->channel) | |
765 { | |
766 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, | |
767 "open socket #%d left in %ui connection, " | |
768 "aborting", | |
769 c[i].fd, i); | |
770 ngx_abort(); | |
771 } | |
772 } | |
773 | |
774 /* | |
775 * we do not destroy cycle->pool here because a signal handler | |
776 * that uses cycle->log can be called at this point | |
777 */ | |
778 | |
779 #if 0 | |
780 ngx_destroy_pool(cycle->pool); | |
781 #endif | |
782 | |
783 exit(0); | |
784 } | 730 } |
785 | 731 |
786 if (ngx_quit) { | 732 if (ngx_quit) { |
787 ngx_quit = 0; | 733 ngx_quit = 0; |
788 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, | 734 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
955 } | 901 } |
956 } | 902 } |
957 | 903 |
958 | 904 |
959 static void | 905 static void |
906 ngx_worker_process_exit(ngx_cycle_t *cycle) | |
907 { | |
908 ngx_uint_t i; | |
909 ngx_connection_t *c; | |
910 | |
911 #if (NGX_THREADS) | |
912 ngx_terminate = 1; | |
913 | |
914 ngx_wakeup_worker_threads(cycle); | |
915 #endif | |
916 | |
917 for (i = 0; ngx_modules[i]; i++) { | |
918 if (ngx_modules[i]->exit_process) { | |
919 ngx_modules[i]->exit_process(cycle); | |
920 } | |
921 } | |
922 | |
923 c = cycle->connections; | |
924 for (i = 0; i < cycle->connection_n; i++) { | |
925 if (c[i].fd != -1 | |
926 && c[i].read | |
927 && !c[i].read->accept | |
928 && !c[i].read->channel) | |
929 { | |
930 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, | |
931 "open socket #%d left in %ui connection, " | |
932 "aborting", | |
933 c[i].fd, i); | |
934 ngx_abort(); | |
935 } | |
936 } | |
937 | |
938 if (ngx_debug_quit) { | |
939 ngx_debug_point(); | |
940 } | |
941 | |
942 /* | |
943 * we do not destroy cycle->pool here because a signal handler | |
944 * that uses cycle->log can be called at this point | |
945 */ | |
946 | |
947 #if 0 | |
948 ngx_destroy_pool(cycle->pool); | |
949 #endif | |
950 | |
951 exit(0); | |
952 } | |
953 | |
954 | |
955 static void | |
960 ngx_channel_handler(ngx_event_t *ev) | 956 ngx_channel_handler(ngx_event_t *ev) |
961 { | 957 { |
962 ngx_int_t n; | 958 ngx_int_t n; |
963 ngx_socket_t fd; | 959 ngx_socket_t fd; |
964 ngx_channel_t ch; | 960 ngx_channel_t ch; |