Bug 8176

Summary: logic error in reclaim_child_processes function called during shutdown
Product: Apache httpd-1.3 Reporter: David Winterbourne <davew>
Component: coreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: CLOSED FIXED    
Severity: normal    
Priority: P3    
Version: 1.3.23   
Target Milestone: ---   
Hardware: All   
OS: Linux   

Description David Winterbourne 2002-04-16 21:54:43 UTC
This function is called at shutdown to kill off all of the children processes 
that were spawned during startup and runtime. The bug is around line 2742 where 
ap_select is called. It seems that the intention was to use the select command 
as a precision sleep mechanism. As the comment indicates, some time needs to be 
allowed for children processes to do their termination stuff. The problem was 
that ap_select was returning prematurely as a result of a signal interupt 
(errno = EINTR), and therefore was never really sleeping for the expected 
amount of time. This didn't allow enough time for my children process to clean 
themselves up and resulted in various resource leaks. I changed the line from:
ap_select(0, NULL, NULL, NULL, &tv);
while(ap_select(0, NULL, NULL, NULL, &tv) == -1) {}
And while I am not saying that this code is the best way to do this, it did 
work, allowing my children to die a natural death.