Another bug with queryExecute - Threads

Wow, not a good morning for one of my favorite new features of ColdFusion 11. This morning I reported on a bug found with queryExecute by a user on StackOverflow. I did some more digging and found that if you use queryExecute inside a thread, it returns an undefined value. Here is a simple test case:

<cfscript>
	
	data = querynew("id", "varchar", [{id:"a"}, {id:"b"}]);
	
	cfthread(name="d1") {
		thread.result = queryExecute("select * from data", {}, {dbtype:"query"});
	}
	cfthread(name="d2") {
		var result = queryExecute("select sleep(2), title from tblblogentries limit 0,1", {}, {datasource:"myblog"});
		thread.foo = 1;
		thread.result = result;
	}
	cfthread(action="join",name="d1,d2");
	writedump(cfthread);
</cfscript>

<cfdump var="#variables#" showudfs="false" >

In the code above I'm running two threads that use queryExecute. In the first thread the value of result is undefined. In the second thread it throws an error because result is not defined.

So, you can't use queryExecute inside a thread call. I've reported this here: https://bugbase.adobe.com/index.cfm?event=bug&id=3836820.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments