Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:838: Inside #if undefined(NO_SLOW_REQ_BT)
   if (sizeof(th_name))    th_name = " - " + th_name + " -";    report_debug ("###### %s 0x%x%s has been busy for more than %g seconds.\n",    thread == backend_thread ? "Backend thread" : "Thread",    thread->id_number(), th_name, timeout);    int hrnow = gethrtime();    if ((hrnow - last_dump_hrtime) / 1E6 < slow_req_timeout / 2) {    describe_thread (thread);    } else {    last_dump_hrtime = hrnow; -  describe_all_threads (0, threads_disabled); +  mixed err = catch { +  describe_all_threads(0, 1); +  }; +  if (err) master()->handle_error(err);    }    }       threads_disabled = 0; // Paranoia.   }      protected void report_slow_thread_finished (Thread.Thread thread,    float time_spent)   {    string th_name =
Roxen.git/server/base_server/roxen.pike:6341:    // Use master()->describe_backtrace to sidestep the background    // failure wrapper that's active in RUN_SELF_TEST.    report_debug(">> " +    replace (master()->describe_backtrace (thread->backtrace()),    "\n", "\n>> ") +    "\n");   }      // Dump all threads to the debug log.   void describe_all_threads (void|int ignored, // Might be the signal number. -  void|object threads_disabled) +  void|int(0..1) inhibit_threads_disabled)   { -  if (!threads_disabled) +  object threads_disabled; +  if (!inhibit_threads_disabled)    // Disable all threads to avoid potential locking problems while we    // have the backtraces. It also gives an atomic view of the state.    threads_disabled = _disable_threads();       array(Thread.Thread) threads = all_threads();       report_debug("###### Describing all %d pike threads:\n>>\n",    sizeof (threads));       threads = Array.sort_array (
Roxen.git/server/base_server/roxen.pike:6369:    else if (b == backend_thread)    return 1;    else    return a->id_number() > b->id_number();    });       foreach (threads, Thread.Thread thread) {    describe_thread (thread);    }    +  threads = 0; +  +  if (catch {    array(array) queue = handle_queue->peek_array();       // Ignore the handle thread shutdown marker, if any.    queue -= ({0});       if (!sizeof (queue)) -  report_debug ("###### No entries in the handler queue\n"); +  report_debug("###### No entries in the handler queue.\n");    else { -  report_debug ("###### %d entries in the handler queue:\n>>\n", +  report_debug("###### %d entries in the handler queue:\n>>\n",    sizeof (queue)); -  foreach (queue; int i; array task) -  report_debug (">> %d: %s\n", i, +  foreach(queue; int i; array task) +  report_debug(">> %d: %s\n", i,    replace (debug_format_queue_task (task), "\n", "\n>> ")); -  report_debug (">> \n"); +  report_debug(">> \n");    } -  +  queue = 0; +  }) { +  report_debug("###### Handler queue busy.\n"); +  }    -  queue = bg_queue->peek_array(); +  if (catch { +  array queue = bg_queue->peek_array();       if (!sizeof (queue))    report_debug ("###### No entries in the background_run queue\n");    else {    report_debug ("###### %d entries in the background_run queue:\n>>\n",    sizeof (queue));    foreach (queue; int i; array task)    report_debug (">> %d: %s\n", i,    replace (debug_format_queue_task (task), "\n", "\n>> "));    report_debug (">> \n");    } -  +  queue = 0; +  }) { +  report_debug("###### background_run queue busy.\n"); +  }       report_debug ("###### Thread and queue dumps done at %s\n", ctime (time()));    -  queue = 0; -  threads = 0; +     threads_disabled = 0;      #ifdef DEBUG    report_debug (RoxenDebug.report_leaks());   #endif   }         // Dump threads by file polling.