Disabling of threads broken in Pike 8.0.354.
Observed in the wild:
Internal server error: Cannot wait for conditions when threads are disabled!
-:1: Thread.Queue(0)->wait(_static_modules.Builtin()->mutex_key())
pike/lib/modules/Thread.pmod:282: Thread.Queue(0)->read()
base_server/roxen.pike (79dbb75e):717: roxen()->handler_thread(0)
The threads disable lock has most likely been taken by another thread running the code:
protected void dump_slow_req (Thread.Thread thread, float timeout)
{
object threads_disabled = _disable_threads();
int count = query ("slow_req_bt_count");
if (count > 0) set ("slow_req_bt_count", count - 1);
if (thread == backend_thread && !slow_be_call_out) {
// Avoid false alarms for the backend thread if we got here due to
// a race. Should perhaps have something like this for the handler
// threads too, but otoh races are more rare there due to the
// longer timeouts.
}
else {
string th_name =
((thread != backend_thread) && thread_name(thread, 1)) || "";
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;
mixed err = catch {
describe_all_threads(0, 1);
};
if (err) master()->handle_error(err);
}
}
threads_disabled = 0; // Paranoia.
}
dump_slow_req()
is called from a call_out
in a dedicated Pike.SmallBackend
in a dedicated thread.