You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@hyperreal.org on 1998/12/10 16:14:10 UTC

cvs commit: apache-1.3/src/main http_main.c

jim         98/12/10 07:14:10

  Modified:    src/main http_main.c
  Log:
  Add 'reset slot vhost' logic to the
  ap_update_child_status function and avoid the race as well.
  
  Revision  Changes    Path
  1.409     +11 -9     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.408
  retrieving revision 1.409
  diff -u -r1.408 -r1.409
  --- http_main.c	1998/12/04 19:12:16	1.408
  +++ http_main.c	1998/12/10 15:14:08	1.409
  @@ -2069,6 +2069,17 @@
   				       sizeof(ss->request));
   	    }
   	    ss->vhostrec =  r->server;
  +	} else if (status == SERVER_STARTING) {
  +	    /* clean up the slot's vhostrec pointer (maybe re-used)
  +	     * and mark the slot as belonging to a new generation.
  +	     */
  +	    ss->vhostrec = NULL;
  +	    ap_scoreboard_image->parent[child_num].generation = ap_my_generation;
  +#ifdef SCOREBOARD_FILE
  +	    lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0);
  +	    force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num],
  +		sizeof(parent_score));
  +#endif
   	}
       }
       put_scoreboard_info(child_num, ss);
  @@ -3917,15 +3928,6 @@
       Explain1("Starting new child in slot %d", slot);
       (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL);
   
  -    /* clean up the slot's vhostrec pointer now that it is being re-used,
  -     * and mark the slot as beloging to a new generation.
  -     */
  -    /* XXX: there's still a race condition here for file-based scoreboards...
  -     * but... like, do we really care to spend yet another write() operation
  -     * here? -djg
  -     */
  -    ap_scoreboard_image->servers[slot].vhostrec = NULL;
  -    ap_scoreboard_image->parent[slot].generation = ap_my_generation;
   
   #ifndef _OSD_POSIX
       if ((pid = fork()) == -1) {
  
  
  

Re: cvs commit: apache-1.3/src/main http_main.c

Posted by Dean Gaudet <dg...@arctic.org>.
This doesn't avoid the race.

You just added a huge race in the in-memory scoreboards.  I'll be
re-instating the second chunk of this patch. 

Dean

On 10 Dec 1998 jim@hyperreal.org wrote:

> jim         98/12/10 07:14:10
> 
>   Modified:    src/main http_main.c
>   Log:
>   Add 'reset slot vhost' logic to the
>   ap_update_child_status function and avoid the race as well.
>   
>   Revision  Changes    Path
>   1.409     +11 -9     apache-1.3/src/main/http_main.c
>   
>   Index: http_main.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
>   retrieving revision 1.408
>   retrieving revision 1.409
>   diff -u -r1.408 -r1.409
>   --- http_main.c	1998/12/04 19:12:16	1.408
>   +++ http_main.c	1998/12/10 15:14:08	1.409
>   @@ -2069,6 +2069,17 @@
>    				       sizeof(ss->request));
>    	    }
>    	    ss->vhostrec =  r->server;
>   +	} else if (status == SERVER_STARTING) {
>   +	    /* clean up the slot's vhostrec pointer (maybe re-used)
>   +	     * and mark the slot as belonging to a new generation.
>   +	     */
>   +	    ss->vhostrec = NULL;
>   +	    ap_scoreboard_image->parent[child_num].generation = ap_my_generation;
>   +#ifdef SCOREBOARD_FILE
>   +	    lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0);
>   +	    force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num],
>   +		sizeof(parent_score));
>   +#endif
>    	}
>        }
>        put_scoreboard_info(child_num, ss);
>   @@ -3917,15 +3928,6 @@
>        Explain1("Starting new child in slot %d", slot);
>        (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL);
>    
>   -    /* clean up the slot's vhostrec pointer now that it is being re-used,
>   -     * and mark the slot as beloging to a new generation.
>   -     */
>   -    /* XXX: there's still a race condition here for file-based scoreboards...
>   -     * but... like, do we really care to spend yet another write() operation
>   -     * here? -djg
>   -     */
>   -    ap_scoreboard_image->servers[slot].vhostrec = NULL;
>   -    ap_scoreboard_image->parent[slot].generation = ap_my_generation;
>    
>    #ifndef _OSD_POSIX
>        if ((pid = fork()) == -1) {
>   
>   
>   
> 


Re: cvs commit: apache-1.3/src/main http_main.c

Posted by Dean Gaudet <dg...@arctic.org>.
No, I'm on crack.  You're right.  Thanks.

Dean

On 10 Dec 1998 jim@hyperreal.org wrote:

> jim         98/12/10 07:14:10
> 
>   Modified:    src/main http_main.c
>   Log:
>   Add 'reset slot vhost' logic to the
>   ap_update_child_status function and avoid the race as well.
>   
>   Revision  Changes    Path
>   1.409     +11 -9     apache-1.3/src/main/http_main.c
>   
>   Index: http_main.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
>   retrieving revision 1.408
>   retrieving revision 1.409
>   diff -u -r1.408 -r1.409
>   --- http_main.c	1998/12/04 19:12:16	1.408
>   +++ http_main.c	1998/12/10 15:14:08	1.409
>   @@ -2069,6 +2069,17 @@
>    				       sizeof(ss->request));
>    	    }
>    	    ss->vhostrec =  r->server;
>   +	} else if (status == SERVER_STARTING) {
>   +	    /* clean up the slot's vhostrec pointer (maybe re-used)
>   +	     * and mark the slot as belonging to a new generation.
>   +	     */
>   +	    ss->vhostrec = NULL;
>   +	    ap_scoreboard_image->parent[child_num].generation = ap_my_generation;
>   +#ifdef SCOREBOARD_FILE
>   +	    lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0);
>   +	    force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num],
>   +		sizeof(parent_score));
>   +#endif
>    	}
>        }
>        put_scoreboard_info(child_num, ss);
>   @@ -3917,15 +3928,6 @@
>        Explain1("Starting new child in slot %d", slot);
>        (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL);
>    
>   -    /* clean up the slot's vhostrec pointer now that it is being re-used,
>   -     * and mark the slot as beloging to a new generation.
>   -     */
>   -    /* XXX: there's still a race condition here for file-based scoreboards...
>   -     * but... like, do we really care to spend yet another write() operation
>   -     * here? -djg
>   -     */
>   -    ap_scoreboard_image->servers[slot].vhostrec = NULL;
>   -    ap_scoreboard_image->parent[slot].generation = ap_my_generation;
>    
>    #ifndef _OSD_POSIX
>        if ((pid = fork()) == -1) {
>   
>   
>   
> 


Re: cvs commit: apache-1.3/src/main http_main.c

Posted by Dean Gaudet <dg...@arctic.org>.
This doesn't avoid the race.

You just added a huge race in the in-memory scoreboards.  I'll be
re-instating the second chunk of this patch. 

Dean

On 10 Dec 1998 jim@hyperreal.org wrote:

> jim         98/12/10 07:14:10
> 
>   Modified:    src/main http_main.c
>   Log:
>   Add 'reset slot vhost' logic to the
>   ap_update_child_status function and avoid the race as well.
>   
>   Revision  Changes    Path
>   1.409     +11 -9     apache-1.3/src/main/http_main.c
>   
>   Index: http_main.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
>   retrieving revision 1.408
>   retrieving revision 1.409
>   diff -u -r1.408 -r1.409
>   --- http_main.c	1998/12/04 19:12:16	1.408
>   +++ http_main.c	1998/12/10 15:14:08	1.409
>   @@ -2069,6 +2069,17 @@
>    				       sizeof(ss->request));
>    	    }
>    	    ss->vhostrec =  r->server;
>   +	} else if (status == SERVER_STARTING) {
>   +	    /* clean up the slot's vhostrec pointer (maybe re-used)
>   +	     * and mark the slot as belonging to a new generation.
>   +	     */
>   +	    ss->vhostrec = NULL;
>   +	    ap_scoreboard_image->parent[child_num].generation = ap_my_generation;
>   +#ifdef SCOREBOARD_FILE
>   +	    lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0);
>   +	    force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num],
>   +		sizeof(parent_score));
>   +#endif
>    	}
>        }
>        put_scoreboard_info(child_num, ss);
>   @@ -3917,15 +3928,6 @@
>        Explain1("Starting new child in slot %d", slot);
>        (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL);
>    
>   -    /* clean up the slot's vhostrec pointer now that it is being re-used,
>   -     * and mark the slot as beloging to a new generation.
>   -     */
>   -    /* XXX: there's still a race condition here for file-based scoreboards...
>   -     * but... like, do we really care to spend yet another write() operation
>   -     * here? -djg
>   -     */
>   -    ap_scoreboard_image->servers[slot].vhostrec = NULL;
>   -    ap_scoreboard_image->parent[slot].generation = ap_my_generation;
>    
>    #ifndef _OSD_POSIX
>        if ((pid = fork()) == -1) {
>   
>   
>   
>