Skip to main content
Inspiring
October 10, 2008
Question

CFTHREAD terminate get logged as error

  • October 10, 2008
  • 1 reply
  • 520 views
When I terminate a thread in this manner to kill runaway thread:

<cfloop list="#t#" index="i">
<cfif findNoCase('RUNNING', evaluate('#i#.status')) gt 0>
<cfsilent>
<cfthread action="terminate" name="#i#" />
</cfsilent>
</cfif>
</cfloop>

Each thread that is terminated gets logged in the application log of the CF administrator with the following value:
myThread34940: null

How do I keep this from getting logged? Why does CF look at these as application errors?
This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
October 12, 2008
I can see your point. But it is so by design. When you terminate a thread, Coldfusion assigns it the value null. However, whenever a Java object assumes a null value, it causes the NullPointerException. That is why terminations are logged as errors. To get more information, append <cfdump var="#cfthread#"> after the loop.

I can imagine one good reason for this design. Here, you have chosen to terminate the threads. It can happen that some other process beyond your control intervenes and prematurely terminates a thread. You should like to have that logged.