[Coldbox 7.3.0] CBFutures Async() Fails When Working with Quick Entities

I am making another attempt to start using the built-in async() functionality within ColdBox, but I’ve run into an issue where my code works fine when run normally, but when run asynchronously, generates an exception behind the scenes.

I created a pretty cool CSV batch import entity, which is powered by Quick. It works great when run normally in my handler, like this:

/**
 * Run
 * Executes the import
 */
function run( event, rc, prc ) {
	
	// Get the desired import entity
	prc.import = getInstance( "Import" ).findOrFail( rc.id );

	// Execute the import task
	prc.import.run();
	
	// Let the next screen know it was successful
	cbMessagebox().setMessage(
		type="success",
		message = "Import executed successfully"
	);
	
	relocate( "imports.#prc.import.getId()#.show." );

}

However, when run async, like this, it fails:

/**
 * runAsync
 * Executes the import asynchronously
 */
function runAsync( event, rc, prc ) {
	
	// Get the desired import entity
	prc.import = getInstance( "Import" ).findOrFail( rc.id );

	// Execute the import task via async()
	async().all( () => {
		prc.import.run();
	} );
	
	return {
		"success" = true,
		"message" = "Import queued successfully"
	};

}

When I check the logs, I see that there’s an error:

[ERROR] java.lang.NullPointerException
[ERROR]         at coldfusion.runtime.UDFMethod.isCovariantReturnType(UDFMethod.java:1002)
[ERROR]         at coldfusion.runtime.UDFMethod.compareUDFAttributes(UDFMethod.java:1103)
[ERROR]         at coldfusion.runtime.UDFMethod.verifyMethodImplementation(UDFMethod.java:798)
[ERROR]         at coldfusion.runtime.UDFMethod.verifyInterfaceMethodImpl(UDFMethod.java:719)
[ERROR]         at coldfusion.runtime.TemplateProxy.verifyInterfaceMethodImpl(TemplateProxy.java:2479)
[ERROR]         at coldfusion.runtime.TemplateProxy.verifyInterfaceImpl(TemplateProxy.java:2533)
[ERROR]         at coldfusion.runtime.TemplateProxy.verifyInterfacesImpl(TemplateProxy.java:2304)
[ERROR]         at coldfusion.runtime.MetadataUtils.getComponentMetadata(MetadataUtils.java:188)
[ERROR]         at coldfusion.runtime.MetadataUtils.getComponentMetadata(MetadataUtils.java:159)
[ERROR]         at coldfusion.runtime.MetadataUtils.getComponentMetadata(MetadataUtils.java:146)
[ERROR]         at coldfusion.runtime.CfJspPage.GetComponentMetadata(CfJspPage.java:5197)
[ERROR]         at cfUtil2ecfc2139880805$funcGETINHERITEDMETADATA.runFunction(D:\Dropbox\Repositories\ccis-api-admin\coldbox\system\core\util\Util.cfc:414)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4327)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4290)
[ERROR]         at cfMapping2ecfc1416419417$func_CF_ANONYMOUSCLOSURE_104.runFunction(D:\Dropbox\Repositories\ccis-api-admin\coldbox\system\ioc\config\Mapping.cfc:604)

[ERROR]         at coldfusion.runtime.Closure.invoke(Closure.java:171)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310)
[ERROR]         at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5084)
[ERROR]         at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5064)
[ERROR]         at cfMapping2ecfc1416419417$funcPROCESS.runFunction(D:\Dropbox\Repositories\ccis-api-admin\coldbox\system\ioc\config\Mapping.cfc:615)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623)
[ERROR]         at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:681)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:980)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:762)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4238)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4202)
[ERROR]         at cfInjector2ecfc708847142$funcGETINSTANCE.runFunction(D:\Dropbox\Repositories\ccis-api-admin\coldbox\system\ioc\Injector.cfc:570)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:681)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:980)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:762)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4238)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4202)
[ERROR]         at cfFrameworkSupertype2ecfc1104092509$funcGETINSTANCE.runFunction(D:\Dropbox\Repositories\ccis-api-admin\coldbox\system\FrameworkSupertype.cfc:95)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310)
[ERROR]         at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5084)
[ERROR]         at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5064)
 at cfImports2ecfc997343443$funcRUNASYNC.runFunction(D:\Dropbox\Repositories\ccis-api-admin\handlers\Imports.cfc:355)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623)
[ERROR]         at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
[ERROR]         at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
[ERROR]         at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438)
[ERROR]         at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:681)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:980)
[ERROR]         at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:762)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4238)
[ERROR]         at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4202)
[ERROR]         at coldfusion.runtime.CFPage.invoke(CFPage.java:16857)

Weird right?

I am using ACF 2021.0.18 via Commandbox. If anyone has any tips or suggestions, please let me know.

Side note: The asynchronous code works when I use cfthread like this:

/**
 * runAsync
 * Executes the import asynchronously
 */
function runAsync( event, rc, prc ) {
	
	// Get the desired import entity
	prc.import = getInstance( "Import" ).findOrFail( rc.id );

	// Execute the import task via cfthread
	thread
		name="import-#prc.import.getId()#" 
		action="run" 
		priority="low" 
		target = prc.import 
	{
		target.run();
	}
	
	return {
		"success" = true,
		"message" = "Import queued successfully"
	};

}