httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: [PATCH] Select/accept parameter reinitialization, bugfix
Date Sat, 25 Jan 1997 06:44:49 GMT
On Fri, 24 Jan 1997, Roy T. Fielding wrote:

> <adrian@virginia.edu> notified us of a problem with children for the httpd
> dump core on SIGSEGV regularly, HPUX, version: 10.10, Apache 1.2b4.
> Ben mentioned that the symptoms looked like a stack corruption.
> 
> I think this is being caused when an initial call to select or accept
> fails (for any reason) and the code attempts to reuse the same parameters
> even though they were modified by the call.  In any case, we should be
> reinitializing the parameters before each call even if this isn't the
> cause of the problem.  Patch follows.

Looks good to me.  Note my comment below.


> 
> ......Roy
> 
> Index: http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_main.c,v
> retrieving revision 1.110
> diff -c -r1.110 http_main.c
> *** http_main.c	1997/01/24 21:06:33	1.110
> --- http_main.c	1997/01/25 02:22:15
[...]
>   	    /*fprintf(stderr,"%d check(2a) %d %d\n",getpid(),scoreboard_image->global.exit_generation,generation);*/
>   	    sync_scoreboard_image();
>   	    if(scoreboard_image->global.exit_generation >= generation)
>   		exit(0);
>   
> !             do {
> !                 clen = sizeof(sa_client);
> !                 csd  = accept(sd, &sa_client, &clen);
> !             } while (csd < 0 && errno == EINTR);
> !             if (csd < 0)
> !                 log_unixerr("accept", NULL, "socket error: accept failed",
> !                             server_conf);
> ! 	}
>   
>   	accept_mutex_off(); /* unlock after "accept" */
>   
> 

Are you aware that you are changing what the above loop does?

The existing loop does the accept() until it gets something other than -1
as a return code.  This new one does the accept() until it either gets
something other than -1 or it gets an errno other than EINTR.  The
existing version does seem to be a possible infinite loop though; I'm not 
disagreeing with the change, just making sure it is intended.



Mime
View raw message