Using ns_server commands for automated system
monitoring can result in intermittent server crashes
under moderate load. The current documentation of the
ns_* API makes no mention of this limitation.
Per Jim Davidson:
I don't believe "ns_server all" is thread safe and it would
be expensive to make it so. It's designed for occasional
use in a debugging context, not as part of regular
connection processing. The docs should probably be
updated to make this clear.
...
It appears [ns_server] "active", "all", and "queued" are all
unsafe. "Connections" is safe in that it shouldn't crash
the server but it's not necessary correct in that it does a
dirty read. Check the code in nsd/queue.c for details, in
particular the AppendConn functions which has the
following comments:
/*
* An annoying race condition can be lethal here.
*/
if ( connPtr != NULL ) {
...
/*
* Carefully copy the bytes to avoid chasing a
pointer
* which may be changing in the connection
thread. This
* is not entirely safe but acceptible for a seldom-
used
* admin command.
*/
The problem is either the connPtr or some of the data
buried in the conn can be changing in the running
connection thread. I wouldn't suggest this be fixed
because it could complicate the code and introduce a
performance problem.
Logged In: YES
user_id=21885
Added to documentation on wiki:
http://panoptic.com/wiki/aolserver/653
Closing this bug.