commit nginx for openSUSE:Factory
Hello community, here is the log from the commit of package nginx for openSUSE:Factory checked in at 2012-12-28 22:46:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nginx (Old) and /work/SRC/openSUSE:Factory/.nginx.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nginx", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/nginx/nginx.changes 2012-12-14 09:56:11.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.nginx.new/nginx.changes 2012-12-28 22:46:22.000000000 +0100 @@ -1,0 +2,10 @@ +Mon Dec 17 10:32:12 UTC 2012 - suse@ammler.ch + +- update to 1.2.6 + *) Feature: the $request_time and $msec variables can now be used not + only in the "log_format" directive. + *) Bugfix: cache manager and cache loader processes might not be able to + start if more than 512 listen sockets were used. + *) Bugfix: in the ngx_http_dav_module. + +------------------------------------------------------------------- Old: ---- nginx-1.2.5.tar.gz New: ---- nginx-1.2.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nginx.spec ++++++ --- /var/tmp/diff_new_pack.vbqNmh/_old 2012-12-28 22:46:23.000000000 +0100 +++ /var/tmp/diff_new_pack.vbqNmh/_new 2012-12-28 22:46:23.000000000 +0100 @@ -17,7 +17,7 @@ Name: nginx -Version: 1.2.5 +Version: 1.2.6 Release: 0 # %define pkg_name nginx ++++++ nginx-1.2.5.tar.gz -> nginx-1.2.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/CHANGES new/nginx-1.2.6/CHANGES --- old/nginx-1.2.5/CHANGES 2012-11-13 14:36:14.000000000 +0100 +++ new/nginx-1.2.6/CHANGES 2012-12-11 15:27:17.000000000 +0100 @@ -1,4 +1,15 @@ +Changes with nginx 1.2.6 11 Dec 2012 + + *) Feature: the $request_time and $msec variables can now be used not + only in the "log_format" directive. + + *) Bugfix: cache manager and cache loader processes might not be able to + start if more than 512 listen sockets were used. + + *) Bugfix: in the ngx_http_dav_module. + + Changes with nginx 1.2.5 13 Nov 2012 *) Feature: the "optional_no_ca" parameter of the "ssl_verify_client" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/CHANGES.ru new/nginx-1.2.6/CHANGES.ru --- old/nginx-1.2.5/CHANGES.ru 2012-11-13 14:36:12.000000000 +0100 +++ new/nginx-1.2.6/CHANGES.ru 2012-12-11 15:27:15.000000000 +0100 @@ -1,4 +1,15 @@ +Изменения в nginx 1.2.6 11.12.2012 + + *) Добавление: переменные $request_time и $msec теперь можно + использовать не только в директиве log_format. + + *) Исправление: cache manager и cache loader могли не запускаться, если + использовалось более 512 listen-сокетов. + + *) Исправление: в модуле ngx_http_dav_module. + + Изменения в nginx 1.2.5 13.11.2012 *) Добавление: параметр optional_no_ca директивы ssl_verify_client. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/core/nginx.h new/nginx-1.2.6/src/core/nginx.h --- old/nginx-1.2.5/src/core/nginx.h 2012-11-12 18:03:38.000000000 +0100 +++ new/nginx-1.2.6/src/core/nginx.h 2012-12-10 16:43:41.000000000 +0100 @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1002005 -#define NGINX_VERSION "1.2.5" +#define nginx_version 1002006 +#define NGINX_VERSION "1.2.6" #define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VAR "NGINX" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/core/ngx_connection.c new/nginx-1.2.6/src/core/ngx_connection.c --- old/nginx-1.2.5/src/core/ngx_connection.c 2012-04-03 09:37:31.000000000 +0200 +++ new/nginx-1.2.6/src/core/ngx_connection.c 2012-12-10 18:46:51.000000000 +0100 @@ -749,6 +749,8 @@ ls[i].fd = (ngx_socket_t) -1; } + + cycle->listening.nelts = 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/core/ngx_cycle.c new/nginx-1.2.6/src/core/ngx_cycle.c --- old/nginx-1.2.5/src/core/ngx_cycle.c 2012-11-12 19:39:51.000000000 +0100 +++ new/nginx-1.2.6/src/core/ngx_cycle.c 2012-12-10 19:17:32.000000000 +0100 @@ -447,7 +447,9 @@ continue; } - if (shm_zone[i].shm.size == oshm_zone[n].shm.size) { + if (shm_zone[i].tag == oshm_zone[n].tag + && shm_zone[i].shm.size == oshm_zone[n].shm.size) + { shm_zone[i].shm.addr = oshm_zone[n].shm.addr; if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/core/ngx_shmtx.c new/nginx-1.2.6/src/core/ngx_shmtx.c --- old/nginx-1.2.5/src/core/ngx_shmtx.c 2012-08-06 20:09:23.000000000 +0200 +++ new/nginx-1.2.6/src/core/ngx_shmtx.c 2012-12-10 19:17:32.000000000 +0100 @@ -117,11 +117,11 @@ "sem_wait() failed while waiting on shmtx"); break; } - - ngx_log_debug0(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0, - "shmtx awoke"); } + ngx_log_debug0(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0, + "shmtx awoke"); + continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/modules/ngx_http_dav_module.c new/nginx-1.2.6/src/http/modules/ngx_http_dav_module.c --- old/nginx-1.2.5/src/http/modules/ngx_http_dav_module.c 2012-01-18 16:07:43.000000000 +0100 +++ new/nginx-1.2.6/src/http/modules/ngx_http_dav_module.c 2012-12-10 18:51:10.000000000 +0100 @@ -209,6 +209,11 @@ ngx_ext_rename_file_t ext; ngx_http_dav_loc_conf_t *dlcf; + if (r->request_body == NULL || r->request_body->temp_file == NULL) { + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + ngx_http_map_uri_to_path(r, &path, &root, 0); path.len--; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/modules/perl/nginx.pm new/nginx-1.2.6/src/http/modules/perl/nginx.pm --- old/nginx-1.2.5/src/http/modules/perl/nginx.pm 2012-11-12 18:03:38.000000000 +0100 +++ new/nginx-1.2.6/src/http/modules/perl/nginx.pm 2012-12-10 16:43:41.000000000 +0100 @@ -50,7 +50,7 @@ HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '1.2.5'; +our $VERSION = '1.2.6'; require XSLoader; XSLoader::load('nginx', $VERSION); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_header_filter_module.c new/nginx-1.2.6/src/http/ngx_http_header_filter_module.c --- old/nginx-1.2.5/src/http/ngx_http_header_filter_module.c 2012-07-02 18:51:02.000000000 +0200 +++ new/nginx-1.2.6/src/http/ngx_http_header_filter_module.c 2012-12-11 14:18:50.000000000 +0100 @@ -112,7 +112,7 @@ #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX) ngx_string("500 Internal Server Error"), - ngx_string("501 Method Not Implemented"), + ngx_string("501 Not Implemented"), ngx_string("502 Bad Gateway"), ngx_string("503 Service Temporarily Unavailable"), ngx_string("504 Gateway Time-out"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_request_body.c new/nginx-1.2.6/src/http/ngx_http_request_body.c --- old/nginx-1.2.5/src/http/ngx_http_request_body.c 2012-04-12 21:35:41.000000000 +0200 +++ new/nginx-1.2.6/src/http/ngx_http_request_body.c 2012-12-11 14:18:50.000000000 +0100 @@ -31,9 +31,9 @@ { size_t preread; ssize_t size; + ngx_int_t rc; ngx_buf_t *b; ngx_chain_t *cl, **next; - ngx_temp_file_t *tf; ngx_http_request_body_t *rb; ngx_http_core_loc_conf_t *clcf; @@ -45,12 +45,14 @@ } if (ngx_http_test_expect(r) != NGX_OK) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); if (rb == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } r->request_body = rb; @@ -65,31 +67,9 @@ if (r->headers_in.content_length_n == 0) { if (r->request_body_in_file_only) { - tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); - if (tf == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - tf->file.fd = NGX_INVALID_FILE; - tf->file.log = r->connection->log; - tf->path = clcf->client_body_temp_path; - tf->pool = r->pool; - tf->warn = "a client request body is buffered to a temporary file"; - tf->log_level = r->request_body_file_log_level; - tf->persistent = r->request_body_in_persistent_file; - tf->clean = r->request_body_in_clean_file; - - if (r->request_body_file_group_access) { - tf->access = 0660; - } - - rb->temp_file = tf; - - if (ngx_create_temp_file(&tf->file, tf->path, tf->pool, - tf->persistent, tf->clean, tf->access) - != NGX_OK) - { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + if (ngx_http_write_request_body(r, NULL) != NGX_OK) { + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } } @@ -119,7 +99,8 @@ b = ngx_calloc_buf(r->pool); if (b == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } b->temporary = 1; @@ -130,7 +111,8 @@ rb->bufs = ngx_alloc_chain_link(r->pool); if (rb->bufs == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } rb->bufs->buf = b; @@ -148,7 +130,8 @@ if (r->request_body_in_file_only) { if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } } @@ -175,7 +158,8 @@ r->read_event_handler = ngx_http_read_client_request_body_handler; - return ngx_http_do_read_client_request_body(r); + rc = ngx_http_do_read_client_request_body(r); + goto done; } next = &rb->bufs->next; @@ -205,12 +189,14 @@ rb->buf = ngx_create_temp_buf(r->pool, size); if (rb->buf == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } cl->buf = rb->buf; @@ -235,7 +221,15 @@ r->read_event_handler = ngx_http_read_client_request_body_handler; - return ngx_http_do_read_client_request_body(r); + rc = ngx_http_do_read_client_request_body(r); + +done: + + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + r->main->count--; + } + + return rc; } @@ -419,6 +413,19 @@ } rb->temp_file = tf; + + if (body == NULL) { + /* empty body with r->request_body_in_file_only */ + + if (ngx_create_temp_file(&tf->file, tf->path, tf->pool, + tf->persistent, tf->clean, tf->access) + != NGX_OK) + { + return NGX_ERROR; + } + + return NGX_OK; + } } n = ngx_write_chain_to_temp_file(rb->temp_file, body); @@ -475,19 +482,21 @@ } } + if (ngx_http_read_discarded_request_body(r) == NGX_OK) { + r->lingering_close = 0; + return NGX_OK; + } + + /* == NGX_AGAIN */ + r->read_event_handler = ngx_http_discarded_request_body_handler; if (ngx_handle_read_event(rev, 0) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } - if (ngx_http_read_discarded_request_body(r) == NGX_OK) { - r->lingering_close = 0; - - } else { - r->count++; - r->discard_body = 1; - } + r->count++; + r->discard_body = 1; return NGX_OK; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_special_response.c new/nginx-1.2.6/src/http/ngx_http_special_response.c --- old/nginx-1.2.5/src/http/ngx_http_special_response.c 2012-02-27 12:43:40.000000000 +0100 +++ new/nginx-1.2.6/src/http/ngx_http_special_response.c 2012-12-11 14:18:50.000000000 +0100 @@ -260,9 +260,9 @@ static char ngx_http_error_501_page[] = "<html>" CRLF -"<head><title>501 Method Not Implemented</title></head>" CRLF +"<head><title>501 Not Implemented</title></head>" CRLF "<body bgcolor=\"white\">" CRLF -"<center><h1>501 Method Not Implemented</h1></center>" CRLF +"<center><h1>501 Not Implemented</h1></center>" CRLF ; @@ -384,6 +384,7 @@ case NGX_HTTPS_CERT_ERROR: case NGX_HTTPS_NO_CERT: case NGX_HTTP_INTERNAL_SERVER_ERROR: + case NGX_HTTP_NOT_IMPLEMENTED: r->keepalive = 0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_upstream.c new/nginx-1.2.6/src/http/ngx_http_upstream.c --- old/nginx-1.2.5/src/http/ngx_http_upstream.c 2012-11-13 12:24:14.000000000 +0100 +++ new/nginx-1.2.6/src/http/ngx_http_upstream.c 2012-12-10 17:35:32.000000000 +0100 @@ -1809,9 +1809,16 @@ #if (NGX_HAVE_KQUEUE) if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { - if (c->write->pending_eof) { + if (c->write->pending_eof || c->read->pending_eof) { + if (c->write->pending_eof) { + err = c->write->kq_errno; + + } else { + err = c->read->kq_errno; + } + c->log->action = "connecting to upstream"; - (void) ngx_connection_error(c, c->write->kq_errno, + (void) ngx_connection_error(c, err, "kevent() reported that connect() failed"); return NGX_ERROR; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_upstream_round_robin.c new/nginx-1.2.6/src/http/ngx_http_upstream_round_robin.c --- old/nginx-1.2.5/src/http/ngx_http_upstream_round_robin.c 2012-07-02 18:41:13.000000000 +0200 +++ new/nginx-1.2.6/src/http/ngx_http_upstream_round_robin.c 2012-12-10 17:35:32.000000000 +0100 @@ -430,6 +430,10 @@ if (rrp->peers->single) { peer = &rrp->peers->peer[0]; + if (peer->down) { + goto failed; + } + } else { /* there are several peers */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/http/ngx_http_variables.c new/nginx-1.2.6/src/http/ngx_http_variables.c --- old/nginx-1.2.5/src/http/ngx_http_variables.c 2012-11-13 11:45:23.000000000 +0100 +++ new/nginx-1.2.6/src/http/ngx_http_variables.c 2012-12-11 14:18:50.000000000 +0100 @@ -79,6 +79,8 @@ ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_request_time(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); @@ -108,6 +110,8 @@ ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_msec(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); /* * TODO: @@ -237,6 +241,9 @@ ngx_http_variable_request_body_file, 0, 0, 0 }, + { ngx_string("request_time"), NULL, ngx_http_variable_request_time, + 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, + { ngx_string("status"), NULL, ngx_http_variable_status, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, @@ -285,6 +292,9 @@ { ngx_string("pid"), NULL, ngx_http_variable_pid, 0, 0, 0 }, + { ngx_string("msec"), NULL, ngx_http_variable_msec, + 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, + #if (NGX_HAVE_TCP_INFO) { ngx_string("tcpinfo_rtt"), NULL, ngx_http_variable_tcpinfo, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, @@ -1757,7 +1767,7 @@ { u_char *p; size_t len; - ngx_buf_t *buf, *next; + ngx_buf_t *buf; ngx_chain_t *cl; if (r->request_body == NULL @@ -1782,8 +1792,13 @@ return NGX_OK; } - next = cl->next->buf; - len = (buf->last - buf->pos) + (next->last - next->pos); + len = buf->last - buf->pos; + cl = cl->next; + + for ( /* void */ ; cl; cl = cl->next) { + buf = cl->buf; + len += buf->last - buf->pos; + } p = ngx_pnalloc(r->pool, len); if (p == NULL) { @@ -1791,9 +1806,12 @@ } v->data = p; + cl = r->request_body->bufs; - p = ngx_cpymem(p, buf->pos, buf->last - buf->pos); - ngx_memcpy(p, next->pos, next->last - next->pos); + for ( /* void */ ; cl; cl = cl->next) { + buf = cl->buf; + p = ngx_cpymem(p, buf->pos, buf->last - buf->pos); + } v->len = len; v->valid = 1; @@ -1825,6 +1843,35 @@ static ngx_int_t +ngx_http_variable_request_time(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + u_char *p; + ngx_time_t *tp; + ngx_msec_int_t ms; + + p = ngx_pnalloc(r->pool, NGX_TIME_T_LEN + 4); + if (p == NULL) { + return NGX_ERROR; + } + + tp = ngx_timeofday(); + + ms = (ngx_msec_int_t) + ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec)); + ms = ngx_max(ms, 0); + + v->len = ngx_sprintf(p, "%T.%03M", ms / 1000, ms % 1000) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t ngx_http_variable_connection(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { @@ -1909,6 +1956,30 @@ v->valid = 1; v->no_cacheable = 0; v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_variable_msec(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + u_char *p; + ngx_time_t *tp; + + p = ngx_pnalloc(r->pool, NGX_TIME_T_LEN + 4); + if (p == NULL) { + return NGX_ERROR; + } + + tp = ngx_timeofday(); + + v->len = ngx_sprintf(p, "%T.%03M", tp->sec, tp->msec) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; v->data = p; return NGX_OK; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/os/unix/ngx_files.c new/nginx-1.2.6/src/os/unix/ngx_files.c --- old/nginx-1.2.5/src/os/unix/ngx_files.c 2012-09-24 20:54:28.000000000 +0200 +++ new/nginx-1.2.6/src/os/unix/ngx_files.c 2012-12-10 19:04:54.000000000 +0100 @@ -241,8 +241,12 @@ return NGX_ERROR; } + ngx_log_debug2(NGX_LOG_DEBUG_CORE, file->log, 0, + "writev: %d, %z", file->fd, n); + file->sys_offset += n; file->offset += n; + offset += n; total += n; } while (cl); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nginx-1.2.5/src/os/unix/ngx_process_cycle.c new/nginx-1.2.6/src/os/unix/ngx_process_cycle.c --- old/nginx-1.2.5/src/os/unix/ngx_process_cycle.c 2012-11-12 19:39:51.000000000 +0100 +++ new/nginx-1.2.6/src/os/unix/ngx_process_cycle.c 2012-12-10 18:46:51.000000000 +0100 @@ -20,7 +20,7 @@ static ngx_uint_t ngx_reap_children(ngx_cycle_t *cycle); static void ngx_master_process_exit(ngx_cycle_t *cycle); static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); -static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority); +static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker); static void ngx_worker_process_exit(ngx_cycle_t *cycle); static void ngx_channel_handler(ngx_event_t *ev); #if (NGX_THREADS) @@ -62,7 +62,6 @@ #endif -uint64_t cpu_affinity; static u_char master_process[] = "master process"; @@ -360,10 +359,8 @@ for (i = 0; i < n; i++) { - cpu_affinity = ngx_get_cpu_affinity(i); - - ngx_spawn_process(cycle, ngx_worker_process_cycle, NULL, - "worker process", type); + ngx_spawn_process(cycle, ngx_worker_process_cycle, + (void *) (intptr_t) i, "worker process", type); ch.pid = ngx_processes[ngx_process_slot].pid; ch.slot = ngx_process_slot; @@ -371,8 +368,6 @@ ngx_pass_open_channel(cycle, &ch); } - - cpu_affinity = 0; } @@ -726,12 +721,14 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) { + ngx_int_t worker = (intptr_t) data; + ngx_uint_t i; ngx_connection_t *c; ngx_process = NGX_PROCESS_WORKER; - ngx_worker_process_init(cycle, 1); + ngx_worker_process_init(cycle, worker); ngx_setproctitle("worker process"); @@ -837,9 +834,10 @@ static void -ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority) +ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker) { sigset_t set; + uint64_t cpu_affinity; ngx_int_t n; ngx_uint_t i; struct rlimit rlmt; @@ -853,7 +851,7 @@ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); - if (priority && ccf->priority != 0) { + if (worker >= 0 && ccf->priority != 0) { if (setpriority(PRIO_PROCESS, 0, ccf->priority) == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "setpriority(%d) failed", ccf->priority); @@ -917,8 +915,12 @@ } } - if (cpu_affinity) { - ngx_setaffinity(cpu_affinity, cycle->log); + if (worker >= 0) { + cpu_affinity = ngx_get_cpu_affinity(worker); + + if (cpu_affinity) { + ngx_setaffinity(cpu_affinity, cycle->log); + } } #if (NGX_HAVE_PR_SET_DUMPABLE) @@ -1294,14 +1296,19 @@ void *ident[4]; ngx_event_t ev; - cycle->connection_n = 512; - + /* + * Set correct process type since closing listening Unix domain socket + * in a master process also removes the Unix domain socket file. + */ ngx_process = NGX_PROCESS_HELPER; - ngx_worker_process_init(cycle, 0); - ngx_close_listening_sockets(cycle); + /* Set a moderate number of connections for a helper process. */ + cycle->connection_n = 512; + + ngx_worker_process_init(cycle, -1); + ngx_memzero(&ev, sizeof(ngx_event_t)); ev.handler = ctx->handler; ev.data = ident; -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de