The branch, master has been updated
       via  9731458 swrap: Do not log if we are over the limit in 
find_socket_info_index()
       via  9b01066 swrap: Also log the fd in swrap_socket()
      from  ce38138 swrap: Fix comparison of different signedness

https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 97314589dec9feca4c10c2350dfbd7702ff44cb1
Author: Andreas Schneider <a...@samba.org>
Date:   Tue Nov 13 18:44:39 2018 +0100

    swrap: Do not log if we are over the limit in find_socket_info_index()
    
    There are applications which do:
    
        for (fd = 0; fd <= getdtablesize(); fd++) {
            close(fd)
        };
    
    This produced millions of error messsages.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit 9b01066059a002d15996d797d911fdd693e29cb7
Author: Andreas Schneider <a...@samba.org>
Date:   Tue Nov 13 18:18:22 2018 +0100

    swrap: Also log the fd in swrap_socket()
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/socket_wrapper.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index ae3b2b0..df70df5 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -1540,11 +1540,23 @@ static int find_socket_info_index(int fd)
        }
 
        if ((size_t)fd >= socket_fds_max) {
+               /*
+                * Do not add a log here as some applications do stupid things
+                * like:
+                *
+                *     for (fd = 0; fd <= getdtablesize(); fd++) {
+                *         close(fd)
+                *     };
+                *
+                * This would produce millions of lines of debug messages.
+                */
+#if 0
                SWRAP_LOG(SWRAP_LOG_ERROR,
-                         "The max socket index limit of %zu has been reached, "
-                         "trying to add %d",
-                         socket_fds_max,
-                         fd);
+                         "Looking for a socket info for the fd %d is over the "
+                         "max socket index limit of %zu.",
+                         fd,
+                         socket_fds_max);
+#endif
                return -1;
        }
 
@@ -3161,9 +3173,10 @@ static int swrap_socket(int family, int type, int 
protocol)
        }
 
        SWRAP_LOG(SWRAP_LOG_TRACE,
-                 "Created %s socket for protocol %s",
+                 "Created %s socket for protocol %s, fd=%d",
                  family == AF_INET ? "IPv4" : "IPv6",
-                 real_type == SOCK_DGRAM ? "UDP" : "TCP");
+                 real_type == SOCK_DGRAM ? "UDP" : "TCP",
+                 fd);
 
        return fd;
 }


-- 
Socket Wrapper Repository

Reply via email to