libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 4e9c66466d1ce9ef036ca483fe7d0fc91b9966fb
parent 46a07b6404b749e8d6b2f307db47c5394d375f2a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun,  5 Dec 2021 12:05:06 +0300

Added special log message to report exceeded system limit on number of threads

Diffstat:
Msrc/microhttpd/daemon.c | 28++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -2803,10 +2803,18 @@ new_connection_process_ (struct MHD_Daemon *daemon, { eno = errno; #ifdef HAVE_MESSAGES +#ifdef EAGAIN + if (EAGAIN == eno) + MHD_DLOG (daemon, + _ ("Failed to create a new thread because it would have " \ + "exceeded the system limit on the number of threads or " \ + "no system resources available.\n")); + else +#endif /* EAGAIN */ MHD_DLOG (daemon, _ ("Failed to create a thread: %s\n"), MHD_strerror_ (eno)); -#endif +#endif /* HAVE_MESSAGES */ goto cleanup; } } @@ -7158,10 +7166,18 @@ MHD_start_daemon_va (unsigned int flags, daemon) ) { #ifdef HAVE_MESSAGES +#ifdef EAGAIN + if (EAGAIN == errno) + MHD_DLOG (daemon, + _ ("Failed to create a new thread because it would have " \ + "exceeded the system limit on the number of threads or " \ + "no system resources available.\n")); + else +#endif /* EAGAIN */ MHD_DLOG (daemon, _ ("Failed to create listen thread: %s\n"), MHD_strerror_ (errno)); -#endif +#endif /* HAVE_MESSAGES */ MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex); MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); @@ -7284,6 +7300,14 @@ MHD_start_daemon_va (unsigned int flags, d)) { #ifdef HAVE_MESSAGES +#ifdef EAGAIN + if (EAGAIN == errno) + MHD_DLOG (daemon, + _ ("Failed to create a new pool thread because it would " \ + "have exceeded the system limit on the number of " \ + "threads or no system resources available.\n")); + else +#endif /* EAGAIN */ MHD_DLOG (daemon, _ ("Failed to create pool thread: %s\n"), MHD_strerror_ (errno));