[PATCH 4 of 5] Adjusted ENOBUFS logging level

Maxim Dounin mdounin at mdounin.ru
Fri Mar 1 03:18:20 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1709260942 -10800
#      Fri Mar 01 05:42:22 2024 +0300
# Node ID 37ef53ecd6b09d37b41d29a02e19b63e9d643994
# Parent  c769217b4a5ce653bc4c895e159105e375bf583f
Adjusted ENOBUFS logging level.

On local datagram sockets ENOBUFS might legitimately appear due to
insufficient space in socket buffers, as seen on BSD systems.
Accordingly, ngx_connection_error() now logs it with logging level
set for the particular connection errors, either "info" or "error"
(instead of "alert", which was previously used).

diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -1600,7 +1600,8 @@ ngx_connection_error(ngx_connection_t *c
         || err == NGX_ENETDOWN
         || err == NGX_ENETUNREACH
         || err == NGX_EHOSTDOWN
-        || err == NGX_EHOSTUNREACH)
+        || err == NGX_EHOSTUNREACH
+        || err == NGX_ENOBUFS)
     {
         switch (c->log_error) {
 
diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h
--- a/src/os/unix/ngx_errno.h
+++ b/src/os/unix/ngx_errno.h
@@ -55,6 +55,7 @@ typedef int               ngx_err_t;
 #define NGX_ELOOP         ELOOP
 #define NGX_EBADF         EBADF
 #define NGX_EMSGSIZE      EMSGSIZE
+#define NGX_ENOBUFS       ENOBUFS
 
 #if (NGX_HAVE_OPENAT)
 #define NGX_EMLINK        EMLINK
diff --git a/src/os/win32/ngx_errno.h b/src/os/win32/ngx_errno.h
--- a/src/os/win32/ngx_errno.h
+++ b/src/os/win32/ngx_errno.h
@@ -58,6 +58,7 @@ typedef DWORD                      ngx_e
 #define NGX_ELOOP                  0
 #define NGX_EBADF                  WSAEBADF
 #define NGX_EMSGSIZE               WSAEMSGSIZE
+#define NGX_ENOBUFS                WSAENOBUFS
 
 #define NGX_EALREADY               WSAEALREADY
 #define NGX_EINVAL                 WSAEINVAL




More information about the nginx-devel mailing list