open socket #103 left in 2 connection

Igor Sysoev is at rambler-co.ru
Tue Mar 10 13:38:00 MSK 2009


On Tue, Mar 10, 2009 at 01:12:51PM +0300, Alexey Rymonin wrote:

> Monday, March 9, 2009, 11:33:19 PM, you wrote:
> 
> IS> On Mon, Mar 09, 2009 at 11:25:55PM +0300, Igor Sysoev wrote:
> 
> >> >    И еще очень прошу setsockopt(TCP_NODELAY) failed (22: Invalid
> >> >    argument) while keepalive
> >> > 
> >> >    убрать на уровень бедага... поскольку в Солярке EINVAL посылается
> >> >    когда сокет был закрыт со стороны клиента...
> >> > 
> >> >    у меня лог ошибок на 95% состоит из этих строк :-)
> 
> >> Скорее всего, я сделаю в этом месте исключение для Соляриса.
> 
> IS> Патч.
> 
> Спасибо большое... помогло...

Новый патч, который войдёт в релиз.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/http/ngx_http_request.c
===================================================================
--- src/http/ngx_http_request.c	(revision 1869)
+++ src/http/ngx_http_request.c	(working copy)
@@ -2420,8 +2420,15 @@
                        (const void *) &tcp_nodelay, sizeof(int))
             == -1)
         {
+#if (NGX_SOLARIS)
+            /* Solaris returns EINVAL if a socket has been shut down */
+            c->log_error = NGX_ERROR_IGNORE_EINVAL;
+#endif
+
             ngx_connection_error(c, ngx_socket_errno,
                                  "setsockopt(TCP_NODELAY) failed");
+
+            c->log_error = NGX_ERROR_INFO;
             ngx_http_close_connection(c);
             return;
         }
Index: src/core/ngx_connection.c
===================================================================
--- src/core/ngx_connection.c	(revision 1869)
+++ src/core/ngx_connection.c	(working copy)
@@ -782,12 +782,16 @@
 {
     ngx_uint_t  level;
 
-    if (err == NGX_ECONNRESET
-        && c->log_error == NGX_ERROR_IGNORE_ECONNRESET)
-    {
+    if (err == NGX_ECONNRESET && c->log_error == NGX_ERROR_IGNORE_ECONNRESET) {
         return 0;
     }
 
+#if (NGX_SOLARIS)
+    if (err == NGX_EINVAL && c->log_error == NGX_ERROR_IGNORE_EINVAL) {
+        return 0;
+    }
+#endif
+
     if (err == 0
         || err == NGX_ECONNRESET
 #if !(NGX_WIN32)
@@ -803,6 +807,7 @@
     {
         switch (c->log_error) {
 
+        case NGX_ERROR_IGNORE_EINVAL:
         case NGX_ERROR_IGNORE_ECONNRESET:
         case NGX_ERROR_INFO:
             level = NGX_LOG_INFO;
Index: src/core/ngx_connection.h
===================================================================
--- src/core/ngx_connection.h	(revision 1869)
+++ src/core/ngx_connection.h	(working copy)
@@ -69,10 +69,11 @@
 
 
 typedef enum {
-     NGX_ERROR_CRIT = 0,
+     NGX_ERROR_ALERT = 0,
      NGX_ERROR_ERR,
      NGX_ERROR_INFO,
-     NGX_ERROR_IGNORE_ECONNRESET
+     NGX_ERROR_IGNORE_ECONNRESET,
+     NGX_ERROR_IGNORE_EINVAL
 } ngx_connection_log_error_e;
 
 
@@ -131,7 +132,7 @@
 
     unsigned            buffered:8;
 
-    unsigned            log_error:2;     /* ngx_connection_log_error_e */
+    unsigned            log_error:3;     /* ngx_connection_log_error_e */
 
     unsigned            single_connection:1;
     unsigned            unexpected_eof:1;


More information about the nginx-ru mailing list