I think it's better to show the code.
This is the code in the InsertStatus.cfm template. It's not that complex:
<cfthread action="run" name="ThreadID#CreateGUID()#" Customer_UserID="#getCustomer.Customer_UserID#" LocationID="#getCustomer.LocationID#" Lead_StatusID="#getCustomer.Current_LeadStatusID#">
<cfmodule template="/index.cfm" fuseaction="Events.AutomatedProcess_Trigger" Customer_UserID="#Attributes.Customer_UserID#"
I've also tried placing try/catch around all the code and it does not catch the error, it only shows up in the exception & application log file in the cf administrator, so I don't think it's specifically code based. Although the module it calls is fairly complex and can take a minute or two to complete. This template also get called a lot.
I'm not too sure about the way you introduce metadata into the cfthread tag. Couldn't you have done something like this?
<cfthread action="run" name="ThreadID#CreateGUID()#">
<cfmodule template="/index.cfm" fuseaction="Events.AutomatedProcess_Trigger" Customer_UserID="#getCustomer.Customer_UserID#"
I've replace the cfthread tag with a call to an eventgateway with the same code and I no longer have the issue. I suspect it's down deeper in the core cfmx code than I want to go. I use cfthread in other places with no issue, it's just that this code is run often and can run for up to a minute, so I must have run into an issue there somewhere. I'm fine moving it to an eventgateway as it appears to like it there.
I've replace the cfthread tag with a call to an eventgateway with the same code
Conceptually the same thing, really. Nice it now works.
I'd also like to give credit to FusionReactor and their server monitor tool. This tool let me track down the specific piece of code having the issue so I could focus on it specifically. I was having memory spikes but didn't know where they were happening untill I installed it and logged it happening.
Anyway, if anyone is having issues or just want to monitor their CFMX instances I'd suggest they give it a try. I find it handy for general site monitoring too.
We shouldn't leave the impression here that there is an issue with cfthread. As far as I know, there are no issues with cfthread.
It is in fact one of the most welcome additions to Coldfusion. It is lighter than a CFML gateway and offers you more control. However, working with threads requires skill and caution.
Hi, I've come across this same problem, but I cannot use event gateways as a fix.
It's one thread that causes the problem.
coldfusion.runtime.UndefinedVariableException: Variable _cffunccfthread_cfc8570911 is undefined.
It occurs after about 10 or 15 minutes of running the same test continously (about 600-800 runs). The threads (10 of them) are defined and run in a loop. Has anyone come across this issue before? I can't find anything else other than this topic online.