2008-09-25
2008-09-25 20:40:14 by Martin Stjernholm <mast@lysator.liu.se>
-
0be32565013e09c0f3b5d5a497b10060226f2049
(34 lines)
(+18/-16)
[
Show
| Annotate
]
Branch: 5.2
Extended the slow request thread dump feature with a counter to limit the
number of thread dumps it might do.
Rev: server/base_server/global_variables.pike:1.113
Rev: server/base_server/roxen.pike:1.989
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.
// ABS and suicide systems contributed freely by Francesco Chemolli
- constant cvs_version="$Id: roxen.pike,v 1.988 2008/09/22 15:18:02 mast Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.989 2008/09/25 20:40:14 mast Exp $";
//! @appears roxen
//!
621: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
slow_req_monitor (3600);
}
- void set_slow_req_timeout (float secs)
+ void slow_req_count_changed()
{
- #ifdef DEBUG
- if (secs < 0) error ("Invalid timeout.\n");
- #endif
-
+
Pike.Backend monitor = slow_req_monitor;
- slow_req_timeout = secs;
+ int count = query ("slow_req_bt_count");
- if (secs > 0.0 && monitor) {
- // Just a change of timeout - nothing more to do.
+ if (count && monitor) {
+ // Just a change of the count - nothing to do.
}
- else if (secs > 0.0) { // Start.
+ else if (count) { // Start.
monitor = slow_req_monitor = Pike.SmallBackend();
Thread.thread_create (slow_req_monitor_thread, monitor);
monitor->call_out (lambda () {}, 0); // Safeguard if there's a race.
646: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
}
}
+ void slow_req_timeout_changed()
+ {
+ #ifdef DEBUG
+ if (query ("slow_req_bt_timeout") < 0) error ("Invalid timeout.\n");
+ #endif
+ slow_req_timeout = query ("slow_req_bt_timeout");
+ }
+
protected void dump_slow_req (Thread.Thread thread, float timeout)
{
-
+ int count = query ("slow_req_bt_count");
+ if (count > 0) set ("slow_req_bt_count", count - 1);
+
report_debug ("### Thread 0x%x has been busy for more than %g seconds.\n",
thread->id_number(), timeout);
describe_all_threads();
5344:
cdt_changed (getvar ("dump_threads_by_file"));
}
- #ifndef NO_SLOW_REQ_BT
- if (float timeout = query ("slow_req_bt"))
- if (timeout > 0.0)
- set_slow_req_timeout (timeout);
- #endif
-
+
#ifdef ROXEN_DEBUG_MEMORY_TRACE
restart_roxen_debug_memory_trace();
#endif