From: Bill Erickson Date: Wed, 13 May 2020 17:55:43 +0000 (-0400) Subject: LP#1919502 C listener backlog loop speedbump X-Git-Tag: osrf_rel_3_2_3~9 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0821dbdc35d1fa646d3bb30ef97bbde1bcf15b97;p=OpenSRF.git LP#1919502 C listener backlog loop speedbump When the request backlog contains items in the C forking code, attempts to process the request run in a tight loop without stopping until the backlog is once again empty. This can lead to spewing "Could not launch a new child" warning messages at a high rate, saturating log files. This commit adds a 1 second speed bump between backlog processing loops to allow time for drones to complete their task and start processing the remaining queued requests. The delay has a secondary affect of limited the speed of the warning log spewing. This 1-second speedbump logic matches that of the Perl code. Signed-off-by: Bill Erickson Signed-off-by: Jeff Davis Signed-off-by: Galen Charlton --- diff --git a/src/libopensrf/osrf_prefork.c b/src/libopensrf/osrf_prefork.c index a9f7c42..845a64e 100644 --- a/src/libopensrf/osrf_prefork.c +++ b/src/libopensrf/osrf_prefork.c @@ -885,8 +885,11 @@ static void prefork_run( prefork_simple* forker ) { cur_msg = client_recv( forker->connection, -1 ); received_from_network = 1; } else { - // See if any messages are immediately available - cur_msg = client_recv( forker->connection, 0 ); + // We have queued messages, which means all of our drones + // are occupied. See if any new messages are available on the + // network while waiting up to 1 second to allow time for a drone + // to become available to handle the next request in the queue. + cur_msg = client_recv( forker->connection, 1 ); if ( cur_msg != NULL ) received_from_network = 1; }