aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-12-05 12:05:06 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-12-05 12:05:06 +0300
commit4e9c66466d1ce9ef036ca483fe7d0fc91b9966fb (patch)
treed189acf03ab5af98d64adf19b5f12a57f0445f9b
parent46a07b6404b749e8d6b2f307db47c5394d375f2a (diff)
downloadlibmicrohttpd-4e9c66466d1ce9ef036ca483fe7d0fc91b9966fb.tar.gz
libmicrohttpd-4e9c66466d1ce9ef036ca483fe7d0fc91b9966fb.zip
Added special log message to report exceeded system limit on number of threads
-rw-r--r--src/microhttpd/daemon.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 4b7df545..b320177a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2803,10 +2803,18 @@ new_connection_process_ (struct MHD_Daemon *daemon,
2803 { 2803 {
2804 eno = errno; 2804 eno = errno;
2805#ifdef HAVE_MESSAGES 2805#ifdef HAVE_MESSAGES
2806#ifdef EAGAIN
2807 if (EAGAIN == eno)
2808 MHD_DLOG (daemon,
2809 _ ("Failed to create a new thread because it would have " \
2810 "exceeded the system limit on the number of threads or " \
2811 "no system resources available.\n"));
2812 else
2813#endif /* EAGAIN */
2806 MHD_DLOG (daemon, 2814 MHD_DLOG (daemon,
2807 _ ("Failed to create a thread: %s\n"), 2815 _ ("Failed to create a thread: %s\n"),
2808 MHD_strerror_ (eno)); 2816 MHD_strerror_ (eno));
2809#endif 2817#endif /* HAVE_MESSAGES */
2810 goto cleanup; 2818 goto cleanup;
2811 } 2819 }
2812 } 2820 }
@@ -7158,10 +7166,18 @@ MHD_start_daemon_va (unsigned int flags,
7158 daemon) ) 7166 daemon) )
7159 { 7167 {
7160#ifdef HAVE_MESSAGES 7168#ifdef HAVE_MESSAGES
7169#ifdef EAGAIN
7170 if (EAGAIN == errno)
7171 MHD_DLOG (daemon,
7172 _ ("Failed to create a new thread because it would have " \
7173 "exceeded the system limit on the number of threads or " \
7174 "no system resources available.\n"));
7175 else
7176#endif /* EAGAIN */
7161 MHD_DLOG (daemon, 7177 MHD_DLOG (daemon,
7162 _ ("Failed to create listen thread: %s\n"), 7178 _ ("Failed to create listen thread: %s\n"),
7163 MHD_strerror_ (errno)); 7179 MHD_strerror_ (errno));
7164#endif 7180#endif /* HAVE_MESSAGES */
7165 MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex); 7181 MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex);
7166 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); 7182 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
7167 MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); 7183 MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
@@ -7284,6 +7300,14 @@ MHD_start_daemon_va (unsigned int flags,
7284 d)) 7300 d))
7285 { 7301 {
7286#ifdef HAVE_MESSAGES 7302#ifdef HAVE_MESSAGES
7303#ifdef EAGAIN
7304 if (EAGAIN == errno)
7305 MHD_DLOG (daemon,
7306 _ ("Failed to create a new pool thread because it would " \
7307 "have exceeded the system limit on the number of " \
7308 "threads or no system resources available.\n"));
7309 else
7310#endif /* EAGAIN */
7287 MHD_DLOG (daemon, 7311 MHD_DLOG (daemon,
7288 _ ("Failed to create pool thread: %s\n"), 7312 _ ("Failed to create pool thread: %s\n"),
7289 MHD_strerror_ (errno)); 7313 MHD_strerror_ (errno));