Cfthread in Lucee and ACF


I’m running an application that makes heavy use of cfthread to improve performance.
However I found some issues, which I could nail down to a testcase.
While this testcase behaves somehow buggy on Lucee, it run fine under ACF.

I’m running Lucee und Windows Java 8 with Caucho Resin.

Maybe someone can reproduce the problem in another setup?

This testcase consists of three files:


<cfsetting requesttimeout="600000">
<cftimer  label="threads" type="outline">
    <cfset lthreads="">
    <cfloop from="1" to="300" index="ind">

        <cfset sThreadName="testname" & ind>
        <cfthread  name="#sThreadName#" iInd="#ind#">
            <cfobject name="thread.oThreading" component="threading">
            <cfset thread.sOutput=thread.oThreading.httpcall(searchid=iInd)>
            <cfif isDefined("thread.sOutput")>
                iInd: #iInd#, #thread.sOutput#<br/>

<!--- insert sleep here --->
        <cfset lthreads=listAppend(lthreads, sThreadName)>

    <cfthread action="join" name="#lthreads#" timeout="6000"/> 

        <cfloop from="1" to="300" index="ind">
            <cfset sThreadName="testname" & ind>
            <cfset threadname=evaluate(sThreadname)>
            <cfif isstruct(threadname)>
                <cfif not len(threadname.output)>


threading.cfc (you may need to adjust port in cfhttp)

    <cffunction  name="httpcall">
        <cfargument name="searchid" required="no">

        <cfhttp method="post" url="" result="thread.httprequest" port="80">
            <cfhttpparam type="formField" name="searchid" value="#searchid#">
        <cfif isDefined("thread.httprequest.filecontent")>
            <cfset sleep(15)>
            <cfreturn trim(thread.httprequest.filecontent)>
            <cfset thread.sMessage="error">
            <cfreturn thread.sMessage>



<cfif isdefined("form.searchid")>
    <cfset sleep(60)>

Then open the index.cfm from a browser.
I expected to not see "empty" as output, but depending on the count of the loops in index.cfm I get more and more empty results from the threads.
ACF runs smoothly, as expected. 

By adding a sleep in the comment, Lucee can handle the code as expected, but that slows down the application significantly. 

Is there a general problem in Lucee, or is this specific to my setup and maybe existing thread-limits?

Thanks in advance

How does it run with the latest 5.3.3-60RC ?

The latest Lucee 5.3.3-60 doesn’t work either.
I also tried some older 4.5, which has the same issue.

Is there a limit saying 20 threads is ok, but 700 is not?

File a bug!

Filed a bug:

1 Like