So this is a weird one. Please note that myself (and the other guys working on this) are still digging in so we may be wrong, but it appears that the use of cfthread in a CFC method, along with the use of local scope, is causing a bug in ColdFusion 9. For an example, see the code below.

<cffunction name="test"> <cfset local = structNew()>

<cfthread name="doogus" action="run"> </cfthread>

<cfquery name="local.foo" datasource="ormtest"> select distinct id, name from [user] </cfquery> <cfdump var="#local#"> <cfreturn valueList(local.foo.id)> </cffunction>

<cfoutput>#test()# #now()#</cfoutput><p>

As you can see, I've got a method, test, than runs a thread and then does a query. Notice I use the new local scope so I don't have to var it above. Upon running this, we are seeing an error when we try to use the valueList function. The error states that the parameter passed to valueList is invalid. Even more interesting, the dump shows only arguments.

But wait - it gets better. Both myself and Tony Nelson and others confirmed that if you run this code you will get the right result about 40% of the time. Essentially a bit less than half. On those runs, the local scope shows the query and the return runs fine.

The fix? Don't use local.whatever. If I switch to var foo = "" and then just use foo instead of local.foo, it works.

So.... any thoughts on this? I've filed bug 82861 for this.