[nginx] Configure: moved NGX_SBIN_PATH variable initialization.

2015-06-10 Thread Ruslan Ermilov
details:   http://hg.nginx.org/nginx/rev/c983c8dea44c
branches:  
changeset: 6176:c983c8dea44c
user:  Ruslan Ermilov r...@nginx.com
date:  Wed Jun 10 12:25:31 2015 +0300
description:
Configure: moved NGX_SBIN_PATH variable initialization.

It's now initialized in auto/options like the rest of variables
for system paths.

As a side effect, the currently unused macro NGX_SBIN_PATH now
gets the correct value.

diffstat:

 auto/install |  4 
 auto/options |  1 +
 2 files changed, 1 insertions(+), 4 deletions(-)

diffs (25 lines):

diff -r 8807a2369b1a -r c983c8dea44c auto/install
--- a/auto/install  Thu Jun 04 13:04:12 2015 +0300
+++ b/auto/install  Wed Jun 10 12:25:31 2015 +0300
@@ -20,10 +20,6 @@ case .$NGX_SBIN_PATH in
 ./*)
 ;;
 
-.)
-NGX_SBIN_PATH=$NGX_PREFIX/sbin/nginx
-;;
-
 *)
 NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH
 ;;
diff -r 8807a2369b1a -r c983c8dea44c auto/options
--- a/auto/options  Thu Jun 04 13:04:12 2015 +0300
+++ b/auto/options  Wed Jun 10 12:25:31 2015 +0300
@@ -525,6 +525,7 @@ if [ .$NGX_PLATFORM = .win32 ]; then
 fi
 
 
+NGX_SBIN_PATH=${NGX_SBIN_PATH:-sbin/nginx}
 NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
 NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
 NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Configure: search OpenSSL in a bunch of standard places.

2015-06-10 Thread Ruslan Ermilov
details:   http://hg.nginx.org/nginx/rev/4d25ec8f0adb
branches:  
changeset: 6177:4d25ec8f0adb
user:  Ruslan Ermilov r...@nginx.com
date:  Wed Jun 10 12:25:45 2015 +0300
description:
Configure: search OpenSSL in a bunch of standard places.

diffstat:

 auto/lib/openssl/conf |  48 
 1 files changed, 48 insertions(+), 0 deletions(-)

diffs (58 lines):

diff -r c983c8dea44c -r 4d25ec8f0adb auto/lib/openssl/conf
--- a/auto/lib/openssl/conf Wed Jun 10 12:25:31 2015 +0300
+++ b/auto/lib/openssl/conf Wed Jun 10 12:25:45 2015 +0300
@@ -55,6 +55,54 @@ else
 ngx_feature_test=SSL_library_init()
 . auto/feature
 
+if [ $ngx_found = no ]; then
+
+# FreeBSD port
+
+ngx_feature=OpenSSL library in /usr/local/
+ngx_feature_path=/usr/local/include
+
+if [ $NGX_RPATH = YES ]; then
+ngx_feature_libs=-R/usr/local/lib -L/usr/local/lib -lssl 
-lcrypto
+else
+ngx_feature_libs=-L/usr/local/lib -lssl -lcrypto
+fi
+
+. auto/feature
+fi
+
+if [ $ngx_found = no ]; then
+
+# NetBSD port
+
+ngx_feature=OpenSSL library in /usr/pkg/
+ngx_feature_path=/usr/pkg/include
+
+if [ $NGX_RPATH = YES ]; then
+ngx_feature_libs=-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto
+else
+ngx_feature_libs=-L/usr/pkg/lib -lssl -lcrypto
+fi
+
+. auto/feature
+fi
+
+if [ $ngx_found = no ]; then
+
+# MacPorts
+
+ngx_feature=OpenSSL library in /opt/local/
+ngx_feature_path=/opt/local/include
+
+if [ $NGX_RPATH = YES ]; then
+ngx_feature_libs=-R/opt/local/lib -L/opt/local/lib -lssl 
-lcrypto
+else
+ngx_feature_libs=-L/opt/local/lib -lssl -lcrypto
+fi
+
+. auto/feature
+fi
+
 if [ $ngx_found = yes ]; then
 have=NGX_SSL . auto/have
 CORE_LIBS=$CORE_LIBS $ngx_feature_libs $NGX_LIBDL

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Configure: added gcc5 to the list of known GCC versions.

2015-06-10 Thread Valentin Bartenev
details:   http://hg.nginx.org/nginx/rev/c041f1e0655f
branches:  
changeset: 6178:c041f1e0655f
user:  Valentin Bartenev vb...@nginx.com
date:  Wed Jun 10 19:18:20 2015 +0300
description:
Configure: added gcc5 to the list of known GCC versions.

diffstat:

 auto/cc/gcc |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 4d25ec8f0adb -r c041f1e0655f auto/cc/gcc
--- a/auto/cc/gcc   Wed Jun 10 12:25:45 2015 +0300
+++ b/auto/cc/gcc   Wed Jun 10 19:18:20 2015 +0300
@@ -153,7 +153,7 @@ CFLAGS=$CFLAGS -Wall -Wpointer-arith
 
 
 case $NGX_GCC_VER in
-3.* | 4.* )
+[3-5].*)
 # we have a lot of the unused function arguments
 CFLAGS=$CFLAGS -Wno-unused-parameter
 # 4.2.1 shows the warning in wrong places

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Fix windows issue with multiple workers

2015-06-10 Thread Sergey Brester
 

Hi, 

enclosed you will find an attached changeset, that contains fix for
windows issue with multiple workers (once listening - only one made any
work). 

If someone needs a git version of it: 

https://github.com/sebres/nginx/pull/1/files [1] 

Here [2] you may find a benchmark comparison for that (1 worker column -
measured before fix). 

-- 

Shortly about fix algorithm (changes related are marked as [*],
unchanged - [-]): 

- master process create all listener; 

- [cycle] master process create a worker; 

* [win32] master calls `ngx_share_listening_sockets`: each listener
share (inheritance) info for pid of this worker (cloned via
WSADuplicateSocket), that will be saved in shmem; 

- master process wait until worker will send an event worker_nnn; 

* [win32] worker process executes `ngx_get_listening_share_info` to
obtain shared info, protocol structure that can be used to create a new
socket descriptor for a shared socket; 

* [win32] worker process creates all listener sockets using given shared
info of master; 

- worker process sets an event worker_nnn; 

- master process create next worker, repeat [cycle]. 

-- 

@Maxim Dounin:
1) your suggested way with shared handle and bInheritHandle does not
work, because of:
[quote]
Sockets. No error is returned, but the duplicate handle may not be
recognized by Winsock at the target process. Also, using DUPLICATEHANDLE
interferes with internal reference counting on the underlying object. 
To duplicate a socket handle, use the WSADUPLICATESOCKET function.
[/quote] 

2) proposal to use an environment instead of shared memory can not work
also, because sharing via WSADuplicateSocket should already know a pid
of target process, that uses this handle - specially shared for each
worker. 

BTW, using of `accept_mutex` was disallowed for win32, cause of possible
deadlock if grabbed by a process which can't accept connections.
Because, this is fixed now, I have removed this restriction in
separated commit.
But I think, accept_mutex is not needed in win32 resp. with accept_mutex
it is much slower as without him. So, whats about set default of
`accept_mutex` to `off` on windows platform? 

BTW[2], I have executed extensive tests of this fix, also with reloading
(increase/decrease `worker_processes`), restarting, as well as
auto-restarting of worker, if it was crashed (ex.: have sporadically
killed some worker). 

Regards,
Serg G. Brester (aka sebres). 

 

Links:
--
[1] https://github.com/sebres/nginx/pull/1/files
[2] https://github.com/sebres/nginx/pull/1
# HG changeset patch
# User sebres serg.bres...@sebres.de
# Date 1433956047 -7200
#  Wed Jun 10 19:07:27 2015 +0200
# Node ID 7f0a48e380944d476063419db7e99122e2f17d92
# Parent  1729d8d3eb3acbb79b1b0c1d60b411aacc4f8461
prevent extreme growth of log file if select failed (possible nowait inside)

diff -r 1729d8d3eb3a -r 7f0a48e38094 src/event/modules/ngx_win32_select_module.c
--- a/src/event/modules/ngx_win32_select_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/event/modules/ngx_win32_select_module.c	Wed Jun 10 19:07:27 2015 +0200
@@ -214,6 +214,8 @@ ngx_select_del_event(ngx_event_t *ev, ng
 }
 
 
+static ngx_uint_t ngx_select_err_cntr = 0;
+
 static ngx_int_t
 ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
 ngx_uint_t flags)
@@ -278,7 +280,16 @@ ngx_select_process_events(ngx_cycle_t *c
select ready %d, ready);
 
 if (err) {
-ngx_log_error(NGX_LOG_ALERT, cycle-log, err, select() failed);
+/* because select failed (possible nowait) - prevent extreme growth of log file */
+if (++ngx_select_err_cntr  10) {
+ngx_log_error(NGX_LOG_ALERT, cycle-log, err, select() failed);
+} else if (ngx_select_err_cntr == 10) {
+ngx_log_error(NGX_LOG_ALERT, cycle-log, err, select() failed, 
+ %d times - no more log), 10);
+} else {
+/* prevent 100% cpu usage if nowait - WSAEINVAL etc. */
+ngx_msleep(500);
+}
 
 if (err == WSAENOTSOCK) {
 ngx_select_repair_fd_sets(cycle);
@@ -286,6 +297,7 @@ ngx_select_process_events(ngx_cycle_t *c
 
 return NGX_ERROR;
 }
+ngx_select_err_cntr = 0;
 
 if (ready == 0) {
 if (timer != NGX_TIMER_INFINITE) {
# HG changeset patch
# User sebres serg.bres...@sebres.de
# Date 1433956100 -7200
#  Wed Jun 10 19:08:20 2015 +0200
# Node ID 80e20498d99e0a4065dfd5ec5c1633cdcfc94541
# Parent  7f0a48e380944d476063419db7e99122e2f17d92
Fix windows issue with multiple workers (once listening - only one made any work),
using shared socket handles for each worker process (WSADuplicateHandle).

diff -r 7f0a48e38094 -r 80e20498d99e src/core/ngx_connection.c
--- a/src/core/ngx_connection.c	Wed Jun 10 19:07:27 2015 +0200
+++ b/src/core/ngx_connection.c	Wed Jun 10 19:08:20 2015 +0200
@@ -369,6 +369,9 @@ ngx_open_listening_sockets(ngx_cycle_t *
 ngx_log_t*log;
 ngx_socket_t  s;
 ngx_listening_t  

[PATCH 2 of 2] Configure: create missing intermediates for build directory

2015-06-10 Thread Piotr Sikora
# HG changeset patch
# User Piotr Sikora pi...@cloudflare.com
# Date 1433989099 25200
#  Wed Jun 10 19:18:19 2015 -0700
# Node ID f160d72d2dadc117b8e2dc25eca3d39a346a8eb8
# Parent  4ee03ff4811708bafd07e84c5a71165a52b38299
Configure: create missing intermediates for build directory.

Signed-off-by: Piotr Sikora pi...@cloudflare.com

diff -r 4ee03ff48117 -r f160d72d2dad auto/configure
--- a/auto/configureWed Jun 10 19:18:19 2015 -0700
+++ b/auto/configureWed Jun 10 19:18:19 2015 -0700
@@ -11,7 +11,7 @@ export LC_ALL
 . auto/init
 . auto/sources
 
-test -d $NGX_OBJS || mkdir $NGX_OBJS
+test -d $NGX_OBJS || mkdir -p $NGX_OBJS
 
 echo  $NGX_AUTO_HEADERS_H
 echo  $NGX_AUTOCONF_ERR

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[PATCH 1 of 2] Configure: fix tests with multi-level relative build directory

2015-06-10 Thread Piotr Sikora
# HG changeset patch
# User Piotr Sikora pi...@cloudflare.com
# Date 1433989099 25200
#  Wed Jun 10 19:18:19 2015 -0700
# Node ID 4ee03ff4811708bafd07e84c5a71165a52b38299
# Parent  c041f1e0655f786db5cf1a3e79ca1f464fec0258
Configure: fix tests with multi-level relative build directory.

Signed-off-by: Piotr Sikora pi...@cloudflare.com

diff -r c041f1e0655f -r 4ee03ff48117 auto/unix
--- a/auto/unix Wed Jun 10 19:18:20 2015 +0300
+++ b/auto/unix Wed Jun 10 19:18:19 2015 -0700
@@ -510,7 +510,7 @@ case $NGX_AUTO_CONFIG_H in
 NGX_INCLUDE_AUTO_CONFIG_H=#include \$NGX_AUTO_CONFIG_H\
 ;;
 *)
-NGX_INCLUDE_AUTO_CONFIG_H=#include \../$NGX_AUTO_CONFIG_H\
+NGX_INCLUDE_AUTO_CONFIG_H=#include \$PWD/$NGX_AUTO_CONFIG_H\
 ;;
 esac
 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel