Threads spawned by <CFTHREAD> are queued but never run
I was having a problem with some threads spawned by <CFTHREAD> so I wrote a little test program to see if I could figure out what was going on.
<cflock scope="session" type="exclusive" timeout="10">
<cfset session.count = "0">
</cflock>
<cfloop from="1" to="10" index="idx">
<cfthread name="t#idx#">
<cflock scope="session" type="exclusive" timeout="10">
<cfset session.count ++>
</cflock>
</cfthread>
</cfloop>
<cfset Sleep(5000)>
<cfdump var="#session#">
Spawns 10 threads each of which increments a session variable, waits a few seconds and checks the results. As I expected the count variable was still "0". I tried joining the threads and it just hung until the timeout expired and the variable still wasn't incremented.
I assumed that meant there were some hung threads so I ran the Server Monitor. Oddly enough it showed 0 active threads and 158 queued threads. I reran the script above and it then showed 168 queued threads and still no active ones. If there were hung threads shouldn't they show up as active so I could terminate them?
I had CF restarted, then ran the script above and it produced the expected results (sesson.count = 10). Checked Server Monitor, 0 active & 0 queued. Everything back to normal.
Did some more testing with my actual code and the same thing happened again. So what is going on here? I had CF restarted again but I'd like to figure out how this can be avoided. If there actually are hung processes that aren't showing as active in Monitor is there any way I can kill them without having to restart CF?
Any insights are appreciated.
Ken
