Not sure about 4.0.x, but there is one possible way to do this with
AOLserver 4.5. Consider the following example:
endless.adp:
<%
while 1 {
ns_sleep 1
}
%>
1. Make a request to the new endless.adp:
% telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /endless.adp HTTP/1.0
...
...
...
2. Connect to the AOLserver's control port and get a list of all active
threads:
server1:nscp 1> join [lsort [ns_info threads]] \n
-conn:0- -nssock:driver- 41973248 0 1151073007 ns:connthread {1
127.0.0.1 running GET /endless.adp 21.640792 0}
-main- {} -1610559648 1 1151070426 p:0x0 a:0x0
-nscp:1- -socks- 41975296 1 1151072851 p:0x21b6a5 a:0xbc788
-nssock:driver- -main- 41959936 0 1151070426 p:0x411556 a:0x39608
-sched- -main- 41990656 0 1151070426 p:0x41ff26 a:0x0
-socks- -main- 41970176 0 1151070426 p:0x422e84 a:0x0
3. Use the new "ns_ictl" command to cancel the run-away thread:
From the "ns_ictl" man page:
ns_ictl cancel threadId
Send an asynchronous interrupt request to the specified thread,
canceling any script currently executing on any AOLserver created
interpreter (note the interrupt is not virtual-server specific).
This command utilizes the facilities of Tcl_AsyncMark() to mark
as ready a callback registered with Tcl_AsyncCreate(). The
callback places an error message in the interpreter result and
returns TCL_ERROR to unwind the call stack. The underlying
Tcl facility has limitations, e.g., the interrupt will only be
noticed when Tcl checks via Tcl_AsyncReady() calls between
commands and the interrupt can be caught with a "catch" command.
See the man page for Tcl_AsyncCreate() for details.
server1:nscp 2> ns_ictl cancel 41973248
4. Results:
Connection is closed:
HTTP/1.0 200 OK
MIME-Version: 1.0
Date: Fri, 23 Jun 2006 14:37:12 GMT
Server: AOLserver/4.5.0a
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1
Connection: close
Connection closed by foreign host.
Error is reported in server log:
[23/Jun/2006:10:37:12][308.41973248][-conn:0-] Error: Tcl exception:
async cancel
while executing
"ns_sleep 1"
at line 3 of adp file
"/usr/local/aolserver/servers/server1/pages/endless.adp"
while processing connection #1:
GET /endless.adp HTTP/1.0
Connection thread is reaped:
server1:nscp 3> join [lsort [ns_info threads]] \n
-main- {} -1610559648 1 1151070426 p:0x0 a:0x0
-nscp:1- -socks- 41975296 1 1151072851 p:0x21b6a5 a:0xbc788
-nssock:driver- -main- 41959936 0 1151070426 p:0x411556 a:0x39608
-sched- -main- 41990656 0 1151070426 p:0x41ff26 a:0x0
-socks- -main- 41970176 0 1151070426 p:0x422e84 a:0x0
This won't work in all cases, but can help in some. There's also the new
"ns_loop_ctl" commands for listing, stopping/starting, and canceling
loops created with the new "ns_for", "ns_while", and "ns_foreach"
commands. Again, these won't help you in all cases, but provide much
more granular control then was previously possible.
- n
[EMAIL PROTECTED] wrote:
On AOLserver 4.0.10, "ns_server active" tells me that there are a
couple of bad connections, file uploads that are eating up processor
(the system load is consistently at or above 2.00) but not getting
anywhere (stuck for nearly a day at this point). Is there any way to
terminate those connections without restarting the whole nsd?
-Titi
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the
Subject: field of your email blank.
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.