Index: openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl,v diff -u -N -r1.67.2.30 -r1.67.2.31 --- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 13 Nov 2020 20:13:20 -0000 1.67.2.30 +++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 14 Nov 2020 10:14:08 -0000 1.67.2.31 @@ -432,9 +432,9 @@ incr ::agg_time($url) $totaltime incr ::count(calls:$url) } - + ::xo::remap_pool -runtime [dict get $partialtimes runtime] $method $url - + # # Handling of longcalls counter # @@ -1851,20 +1851,46 @@ } ad_proc ::xo::pool_remap_watchdog {} { + set maxWaiting 10 foreach s [ns_info servers] { - set reqs [ns_server -server $s -pool "" all] + set reqs [ns_server -server $s -pool "" active] foreach req $reqs { set runtime [lindex $req end-1] if {$runtime >= 3.0} { set method [lindex $req 3] set url [lindex $req 4] - ns_log notice "CALL REMAP ::xo::remap_pool -runtime $runtime $method $url" + ns_log notice "CALL TRY REMAP ::xo::remap_pool -runtime $runtime $method $url" ::xo::remap_pool -runtime $runtime $method $url } } + set waiting [ns_server -server $s -pool "" waiting] + if {$waiting >= $maxWaiting} { + set threadInfo [ns_server -server $s -pool "" threads] + lappend threadInfo waiting $waiting + set message "" + append message \ + "Server $s on [ad_system_name]: " \ + "more than $maxWaiting requests are waiting ($threadInfo)" \n \ + "Currently running requests:" \n \ + " " [join $reqs "\n "] \n + ns_log warning $message + try { + # + # Try to send a mail to the webmaster and include a link to + # the recommended nsstats location. + # + acs_mail_lite::send -send_immediately \ + -to_addr [ad_host_administrator] \ + -from_addr [ad_system_owner] \ + -subject "High load warning on [ad_system_name]" \ + -body "$message\nVisit: [ad_url]/admin/nsstats/admin/nsstats" + } on error {errorMsg} { + ns_log error "Cound not send high-load warning: $errorMsg" + } + } } } - + proc is_ip {key} { expr { [string match "*.*" $key] || [string match "*:*" $key] } }