Procházet zdrojové kódy

httpd: Log xs_socket_accept failure reason

So far, it was expected that xs_socket_accept should work and while its
failure results in a termination, it was not properly logged. With this
change, an error message including the strerror message is being logged.

After experiencing some unexpected snac httpd shutdowns, I added a bit
of additional logging, including when xs_socket_accept fails. This
proved useful, as it unveiled a deeper error on my machine:

> xs_socket_accept failed: Too many open files

Since entering this code path results in termination, I thought
upstreaming this logging might be useful for others.
Alvar Penning před 5 měsíci
rodič
revize
c29d691d32
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 3 2
      httpd.c

+ 3 - 2
httpd.c

@@ -1116,9 +1116,10 @@ void httpd(void)
                 FILE *f = fdopen(cs, "r+");
                 xs *job = xs_data_new(&f, sizeof(FILE *));
                 job_post(job, 1);
-            }
-            else
+            } else {
+                srv_log(xs_fmt("error: xs_socket_accept failed: %s", strerror(errno)));
                 break;
+            }
         }
     }