Nmap Development mailing list archives

Re: Possible script deadlock while testing in nse-lua-merge


From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 24 Mar 2009 17:29:13 -0600

[Forwarding this to the list 5 days later because I replied to the wrong sender]

Hello Brandon,

On Thu, Mar 19, 2009 at 12:55 AM, Brandon Enright <bmenrigh () ucsd edu> wrote:
While testing my output table memory patch in your nse-lua-merge branch
I ran into what appears to be a deadlock.  When I turn on packet
tracking (runtime interaction) nothing is being sent or received.

I noticed that there is (new?) output listing the number of script
waiting:

Stats: 1:56:29 elapsed; 370 hosts completed (120 up), 1 undergoing Script Scan
NSE: Active NSE Script Threads: 30 (30 waiting)

I assume this means that I've run into a deadlock.  I've done a heck of
a lot of testing in this branch and this is the first time I've seen a
deadlock like this so I assume the conditions to cause it are pretty
involved.

This is a symptom of the failing nsock library binding which has
plagued NSE with bugs for a while now. That it happened in
nse-lua-merge is merely happenstance. In the future I hope to clean it
up like I did with the nmap library.

My question is, is this the only way to get the list?  At a high
debugging level can we make runtime interaction print the active
scripts?  Perhaps adding a 's' or a 'c' to interaction to print them
would be reasonable.

I plan to add much more debugging output once the final merge has been
completed. For example, I would like to print a stack trace whenever a
script ends abnormally (including timeout). However, it's been
requested I do not add any features to nse-lua-merge until after the
merge has been completed. I will make these additions directly to the
trunk when possible.

As for your list of scripts, I believe there are some scripts which
may be saving references to sockets which is preventing other threads
from connecting sockets (causing the long wait until targets time
out). It is probable that whatever script is doing this is not even in
your listing. There needs to be better accounting for open sockets and
this is also something I want to pursue.

Hope that helps,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: