From a8ebda6ce0f217d1da807ad8a089ffe0ce940a1f Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Wed, 10 Apr 2002 17:02:00 +0000 Subject: [PATCH] The accept loop was sleeping way too long when we ran out of completion contexts. All that is really necessary is that the accept look yield the rest of its time slice when this condition is hit. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94592 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ server/mpm/winnt/mpm_winnt.c | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index d2dd8e385d..f3ca2bd7d2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ Changes with Apache 2.0.36 + *) Win32: Fix problem that caused rapid performance degradation + when number of connecting clients exceeded ThreadsPerChild. + [Bill Stoddard] *) Fixed a segfault parsing large SSIs on non-mmap systems. [Brian Havard] diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 08d0c9dd68..2b965d9ab1 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -921,8 +921,9 @@ static void winnt_accept(void *listen_socket) if (!context) { /* Hopefully whatever is preventing us from getting a * completion context is a temporary resource constraint. + * Yield the rest of our time slice. */ - Sleep(750); + Sleep(0); continue; } @@ -931,11 +932,11 @@ static void winnt_accept(void *listen_socket) if (context->accept_socket == INVALID_SOCKET) { context->accept_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (context->accept_socket == INVALID_SOCKET) { - /* Hopefully another temporary condition. Be graceful. */ + /* Another temporary condition? */ ap_log_error(APLOG_MARK,APLOG_WARNING, apr_get_netos_error(), ap_server_conf, "winnt_accept: Failed to allocate an accept socket. " "Temporary resource constraint? Try again."); - Sleep(500); + Sleep(100); goto again; } } @@ -971,7 +972,7 @@ static void winnt_accept(void *listen_socket) "winnt_accept: AcceptEx failed. Attempting to recover."); closesocket(context->accept_socket); context->accept_socket = INVALID_SOCKET; - Sleep(500); + Sleep(100); goto again; } -- 2.40.0