manoj       99/02/17 00:13:16

  Modified:    .        STATUS
               pthreads/src/main http_main.c
  Log:
  Start to remove pthread calls from clean_child_exit to make it legal for
  a signal handler. There is still a pthread_cancel loop, which seems to
  work sometimes for killing hanging threads, but not all the time. The
  real solution is to fix the hanging threads, which seem to be caused by
  the (accidental?) usage of a cross-process alloc_mutex.
  
  The last commit message was messed up. That patch didn't undo any
  pthread calls during signal handling, but it is still necessary because
  it prevents the thread from trying to join itself. I need someone to
  show me how to change stupid commit messages.
  
  Revision  Changes    Path
  1.9       +3 -1      apache-apr/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/apache-apr/STATUS,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- STATUS    1999/02/17 01:08:18     1.8
  +++ STATUS    1999/02/17 08:13:13     1.9
  @@ -1,5 +1,5 @@
   Apache Portable Runtime STATUS:
  -Last modified at [$Date: 1999/02/17 01:08:18 $]
  +Last modified at [$Date: 1999/02/17 08:13:13 $]
   
   Release:
   
  @@ -40,6 +40,8 @@
       Everything
   
   Needs patch:
  +  * A patch to make the alloc_mutex's scope per-process. It seems to be
  +    causing trouble on Linux at least.
   
   Open issues:
   
  
  
  
  1.38      +17 -3     apache-apr/pthreads/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -u -r1.37 -r1.38
  --- http_main.c       1999/02/17 05:32:00     1.37
  +++ http_main.c       1999/02/17 08:13:15     1.38
  @@ -397,14 +397,29 @@
       listen_rec *lr;
       parent_score *ss = &ap_scoreboard_image->parent[child_num];
   
  +    /* XXX - This should be taken care of by the parent process. When it 
reaps
  +     * the child, it will also update the scoreboard. We can't do this here,
  +     * because clean_child_exit can be called from a signal handler, and
  +     * ap_update_child_status calls pthread_self */
  +#if 0
       for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++)
           ap_update_child_status(child_num, i, SERVER_DEAD, (request_rec *) 
NULL);
  +#endif
   
       if (pchild) {
        ap_child_exit_modules(pchild, server_conf);
        ap_destroy_pool(pchild);
       }
   
  +    /* XXX - This is not allowed in a signal handler either, and it shouldn't
  +     * be needed. But it's still in here, because without it, we get hanging
  +     * threads on linux. The symptom isn't *too* bad on Linux: a core dump in
  +     * the exit() library call.
  +     *
  +     * The root cause seems to be that alloc's pthread mutex is being used
  +     * across processes, which is not kosher on some platforms (i.e. Linux),
  +     * and a thread whacking a pool will hit an acquire_mutex and hang */
  +
       for (i = 0; i < ss->worker_threads + ss->acceptor_threads; i++) {
           if (ap_scoreboard_image->servers[child_num][i].status != 
SERVER_DEAD) {
            pthread_cancel(ap_scoreboard_image->servers[child_num][i].tid);
  @@ -2811,9 +2826,8 @@
           if (pid >= 0) {
               child_slot = find_child_by_pid(0);
               if (child_slot >= 0) {
  -           /*                (void) ap_update_child_status(child_slot, 
SERVER_DEAD,
  -                                         (request_rec *) NULL);
  -                                         LOOK INTO THIS */
  +                for (i = 0; i < ap_threads_per_child + 
ap_acceptors_per_child; i++)
  +                    ap_update_child_status(child_slot, i, SERVER_DEAD, 
(request_rec *) NULL);
   
                if (remaining_children_to_start
                    && child_slot < ap_daemons_limit) {
  
  
  

Reply via email to