Looping with threads - java.lang.NoSuchMethodException: coldfusion.runtime.CFDummyComponent.<init>()
I'm working with an application running on ColdFusion 2018 and Java 11. It uses threads to make multiple http requests at once to reduce the wait time of loading data. About once a month, sometimes more, we start to get error reports of java.lang.NoSuchMethodException: coldfusion.runtime.CFDummyComponent.<init>() on the line of code that creates a thread. I haven't found any pattern to it and the error seems to just keep happening for every request that goes through the affected code path after it's first triggered until the server is restarted. This is occurring in production but I haven't been able to reproduce it locally so I have a feeling it's related to the number of users of the system. Can anyone offer a suggestion on what could be the cause? Please see the related code and error dump snippets below.
threadService.cfc
/*
* Runs all supplied threads and returns the results in a structure where each key
* is the name of a thread and contains the results of running the thread.
* @15173034 An array of thread definition structs. Must contain all of these keys:
* data - A struct of arguments passed to the thread's closure function
* closure - A function that returns another function. The returned function
* is run inside of the thread and can accept the data key as an argument
* name - The thread name
*/
public struct function runAll(required array threads) {
var threadResults = {};
var runnableThreads = [];
for (var threadDefinition in threads) {
arrayAppend(runnableThreads, variables.beanFactory.injectProperties("ThreadBean", {
data: threadDefinition.attributes,
factory: threadDefinition.closure,
name: threadDefinition.name
})
);
}
for (var thread in runnableThreads) {
thread.run();
}
threadJoin();
for (var thread in runnableThreads) {
structInsert(threadResults, thread.getName(), thread.getResult());
}
return threadResults;
}
ThreadBean.cfc
public void function run() {
var threadName = createUUID();
var closure = variables.factory();
thread name=local.threadName doForItem=closure threadData=variables.data { // this is the line the error occurs on
try {
thread.result = doForItem(threadData);
}
catch (any ex) {
variables.error = ex;
}
}
variables.thread = cfthread[local.threadName];
}

