[coldbox-4.1.0] Lucee support for inThread() in system.core.util.Util appears to be broken

I recently upgraded my ColdBox version from 4.0.0-rc+00002 to 4.1.0 AND my Lucee version from 4.5.1.000 to 4.5.1.023. Before the CB update, the inThread() function of the Util.cfc was using a java.lang.Thread object to determine if a segment of code was executing in a thread or not.

This is how I expect that inThread() function to work…

`

<cfif util.inThread()>
… do something

`

<cfif util.inThread()>

... do something

</cfif>

`

<cfif util.inThread()>
… do something

`

The inThread() function returns true ONLY if it is called from a thread that was spun up from the page request thread. Meaning that if your main page request spins up a thread using cfthread tags, than inThread() will return true anytime its called in that tag. If you call inThread() ANYWHERE outside of that cfthread tag (meaning in the page request thread), then it should false. And this is indeed the behavior I observed when using the java.lang.Thread object as the detection method.

But when I upgraded to CB 4.1.0, that inThread() function began using Lucee’s hasFamily() function from the PageContext object (this is the same method that was used for Railo support). The issue I have observed is that once you spin up a cfthread tag, the hasFamily() function is going to return true even in the page request thread. So in other words, the hasFamily() function is going to return true even outside of the cfthread tag after the tag has been evoked.

`

<cfif util.inThread()>
… do something

`

I have confirmed that this is an issue in both Lucee 4.5.1.000 and 4.5.1.023. However I never really noticed this issue before I migrated from Railo to Lucee, so it kinda seems to me like it might be an issue in Lucee (though that is not confirmed).

Has anyone else observed this issue? Or perhaps have any insights from the Lucee side of it?

Anybody else experience this?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox