comparison src/event/ngx_event.c @ 356:b743d290eb3b NGINX_0_6_22

nginx 0.6.22 *) Change: now all ngx_http_perl_module methods return values copied to perl's allocated memory. *) Bugfix: if nginx was built with ngx_http_perl_module, the perl before 5.8.6 was used, and perl supported threads, then during reconfiguration the master process aborted; bug appeared in 0.5.9. Thanks to Boris Zhmurov. *) Bugfix: the ngx_http_perl_module methods may get invalid values of the regex captures. *) Bugfix: a segmentation fault occurred in worker process, if the $r->has_request_body() method was called for a request whose small request body was already received. *) Bugfix: large_client_header_buffers did not freed before going to keep-alive state. Thanks to Olexander Shtepa. *) Bugfix: the last address was missed in the $upstream_addr variable; bug appeared in 0.6.18. *) Bugfix: the "fastcgi_catch_stderr" directive did return error code; now it returns 502 code, that can be rerouted to a next server using the "fastcgi_next_upstream invalid_header" directive. *) Bugfix: a segmentation fault occurred in master process if the "fastcgi_catch_stderr" directive was used; bug appeared in 0.6.10. Thanks to Manlio Perillo.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Dec 2007 00:00:00 +0300
parents 9fc4ab6673f9
children 820f6378fc00
comparison
equal deleted inserted replaced
355:3ac45897a61c 356:b743d290eb3b
426 ngx_event_module_init(ngx_cycle_t *cycle) 426 ngx_event_module_init(ngx_cycle_t *cycle)
427 { 427 {
428 void ***cf; 428 void ***cf;
429 u_char *shared; 429 u_char *shared;
430 size_t size, cl; 430 size_t size, cl;
431 ngx_shm_t shm;
432 ngx_core_conf_t *ccf;
431 ngx_event_conf_t *ecf; 433 ngx_event_conf_t *ecf;
432 ngx_core_conf_t *ccf;
433 ngx_shm_t shm;
434 #if !(NGX_WIN32)
435 ngx_int_t limit;
436 struct rlimit rlmt;
437 #endif
438 434
439 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); 435 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
440 436
441 if (cf == NULL) { 437 if (cf == NULL) {
442 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, 438 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
454 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 450 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
455 451
456 ngx_timer_resolution = ccf->timer_resolution; 452 ngx_timer_resolution = ccf->timer_resolution;
457 453
458 #if !(NGX_WIN32) 454 #if !(NGX_WIN32)
455 {
456 ngx_int_t limit;
457 struct rlimit rlmt;
459 458
460 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { 459 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
461 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 460 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
462 "getrlimit(RLIMIT_NOFILE) failed, ignored"); 461 "getrlimit(RLIMIT_NOFILE) failed, ignored");
463 462
473 "%ui worker_connections are more than " 472 "%ui worker_connections are more than "
474 "open file resource limit: %i", 473 "open file resource limit: %i",
475 ecf->connections, limit); 474 ecf->connections, limit);
476 } 475 }
477 } 476 }
478 477 }
479 #endif /* !(NGX_WIN32) */ 478 #endif /* !(NGX_WIN32) */
480 479
481 480
482 if (ccf->master == 0) { 481 if (ccf->master == 0) {
483 return NGX_OK; 482 return NGX_OK;
571 ngx_listening_t *ls; 570 ngx_listening_t *ls;
572 ngx_connection_t *c, *next, *old; 571 ngx_connection_t *c, *next, *old;
573 ngx_core_conf_t *ccf; 572 ngx_core_conf_t *ccf;
574 ngx_event_conf_t *ecf; 573 ngx_event_conf_t *ecf;
575 ngx_event_module_t *module; 574 ngx_event_module_t *module;
576 #if (NGX_WIN32)
577 ngx_iocp_conf_t *iocpcf;
578 #else
579 struct rlimit rlmt;
580 struct sigaction sa;
581 struct itimerval itv;
582 #endif
583 575
584 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 576 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
585 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); 577 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
586 578
587 if (ccf->master && ccf->worker_processes > 1 && ecf->accept_mutex) { 579 if (ccf->master && ccf->worker_processes > 1 && ecf->accept_mutex) {
623 } 615 }
624 616
625 #if !(NGX_WIN32) 617 #if !(NGX_WIN32)
626 618
627 if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) { 619 if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) {
620 struct sigaction sa;
621 struct itimerval itv;
628 622
629 ngx_memzero(&sa, sizeof(struct sigaction)); 623 ngx_memzero(&sa, sizeof(struct sigaction));
630 sa.sa_handler = ngx_timer_signal_handler; 624 sa.sa_handler = ngx_timer_signal_handler;
631 sigemptyset(&sa.sa_mask); 625 sigemptyset(&sa.sa_mask);
632 626
646 "setitimer() failed"); 640 "setitimer() failed");
647 } 641 }
648 } 642 }
649 643
650 if (ngx_event_flags & NGX_USE_FD_EVENT) { 644 if (ngx_event_flags & NGX_USE_FD_EVENT) {
645 struct rlimit rlmt;
651 646
652 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { 647 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
653 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 648 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
654 "getrlimit(RLIMIT_NOFILE) failed"); 649 "getrlimit(RLIMIT_NOFILE) failed");
655 return NGX_ERROR; 650 return NGX_ERROR;
772 } 767 }
773 768
774 #if (NGX_WIN32) 769 #if (NGX_WIN32)
775 770
776 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { 771 if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
772 ngx_iocp_conf_t *iocpcf;
773
777 rev->handler = ngx_event_acceptex; 774 rev->handler = ngx_event_acceptex;
778 775
779 if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) { 776 if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) {
780 return NGX_ERROR; 777 return NGX_ERROR;
781 } 778 }