# Cfthread NullPointerException

**URL:** <https://dev.lucee.org/t/cfthread-nullpointerexception/8679>\
**Category:** support\
**Created:** [August 2, 2021, 1:00pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679 "2021-08-02T13:00:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 1:00pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/1 "2021-08-02T13:00:25Z")

</div>

does any one have NullPointerException when run a cfthread after upgrade to 5.3.8.189 ?  
downgrading to 5.3.7.48 let cfthread to run again.  
we have two server configuration, and both has the same problem:

1 server  
OS : Ubuntu 20.4.2 LTS  
JAVA : 11.0.11 (Ubuntu) 64bit  
Tomcat Version: 9.0.35

server number 2  
OS: debian 10  
here we made a fresh installation from the new 5.3.8.189 bin file downloaded from luce download page

so java was the embedded packet in lucee and the same for tomcat  
but we had the same problem

“ERROR”,“cfthread-2342”,“07/19/2021”,“19:21:36”,“cfthread-2342”,"java.lang.NullPointerException;java.lang.NullPointerException;java.lang.NullPointerException

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [August 2, 2021, 1:02pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/2 "2021-08-02T13:02:47Z")

</div>

can you share a bit more of the stacktrace? (5 more lines or so) you omitted all the interesting bits

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 1:04pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/3 "2021-08-02T13:04:04Z")

</div>

hy, this is the only text in logs … thread.log … no stack trace inside in both servers

“ERROR”,“cfthread-2338”,“07/19/2021”,“19:03:03”,“cfthread-2338”,"java.lang.NullPointerException;java.lang.NullPointerException;java.lang.NullPointerException

"

“ERROR”,“cfthread-2339”,“07/19/2021”,“19:03:24”,“cfthread-2339”,"java.lang.NullPointerException;java.lang.NullPointerException;java.lang.NullPointerException

"

“ERROR”,“cfthread-2340”,“07/19/2021”,“19:12:34”,“cfthread-2340”,"java.lang.NullPointerException;java.lang.NullPointerException;java.lang.NullPointerException

"

“ERROR”,“cfthread-2341”,“07/19/2021”,“19:13:50”,“cfthread-2341”,"java.lang.NullPointerException;java.lang.NullPointerException;java.lang.NullPointerException

code is

>

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [August 2, 2021, 1:54pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/4 "2021-08-02T13:54:44Z")

</div>

then can you provide us with a little test case which demonstrates the problem?

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 1:58pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/5 "2021-08-02T13:58:05Z")

</div>

i cannot give the access to developer server for security reason, also data are strictly secured and iam not autorizhed to do it… but i can write down 10 line of code to demostrate it… sorry for broken english… i ll setup the evoirment asap…

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [August 2, 2021, 2:08pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/6 "2021-08-02T14:08:18Z")

</div>

a 10 line simplified test case would be perfect, thanks

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 3:28pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/7 "2021-08-02T15:28:24Z")

</div>

sorry, dont understand but is my problem i know)… do u need sample code or a server with the setup and code run on the test server?

---

<div class="post-metadata">

**Author:** ![jedihomer](https://dev.lucee.org/user_avatar/dev.lucee.org/jedihomer/32/24_2.png) [@jedihomer](https://dev.lucee.org/u/jedihomer)\
**Post date:** [August 2, 2021, 3:35pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/8 "2021-08-02T15:35:40Z")

</div>

Are you including files in your thread? I had issues with this…

[https://lucee.daemonite.io/t/npe-on-included-files-in-a-thread/8545](https://lucee.daemonite.io/t/npe-on-included-files-in-a-thread/8545)

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 3:36pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/9 "2021-08-02T15:36:58Z")

</div>

yes i use include…

---

<div class="post-metadata">

**Author:** ![jedihomer](https://dev.lucee.org/user_avatar/dev.lucee.org/jedihomer/32/24_2.png) [@jedihomer](https://dev.lucee.org/u/jedihomer)\
**Post date:** [August 2, 2021, 3:37pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/10 "2021-08-02T15:37:58Z")

</div>

We rolled back back the version on the server performing the threading.

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 3:38pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/11 "2021-08-02T15:38:25Z")

</div>

```auto
<cfsetting requestTimeOut="9999999999999">
<cfset url.secret = "123">
<cftransaction>
  <cfset taglicreati = ArrayNew(1)>
  <cfset ArrayAppend(taglicreati, 1)>
</cftransaction>
<cfthread action="run" name="cart_PL_#url.id_odlj#_#url.id#">
  <cfsetting requestTimeOut="999999999">
  <cfinclude template="/secure/bin/cart_taglio_multi.cfm">
</cfthread>

<!---- cart_taglio_multi.cfm ----->

<cfquery name="taglio" datasource="dbmaga">
select *
from xxxxx
where xxxxx.id1 = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
and xxxxx.id2 = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id_odlj#">
and xxxxx.c = FALSE;
</cfquery>

<cfloop query="taglio">
    <cfinclude template="cart_taglio_multi_include.cfm">
	<cfexecute name="/usr/bin/convert" arguments='xxxxx'></cfexecute>
	<cfif not isdefined("url.noprint")>
	<cfexecute name="lpr" arguments="-H 127.0.0.1:631 -P #url.printerpl# xxxxxx.pdf"></cfexecute>
	</cfif>
</cfloop>   

```

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 3:40pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/12 "2021-08-02T15:40:38Z")

</div>

we did the same… no way to run the 5.3.8.189 in production evoirment.

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [August 2, 2021, 3:48pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/13 "2021-08-02T15:48:18Z")

</div>

could be related to this [[LDEV-3627] - Lucee](https://luceeserver.atlassian.net/browse/LDEV-3627) (but I’m not sure if it windows only, or maybe linux too, i’m assuming it doesn’t fail on MacOS @micstriit ? )

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 2, 2021, 3:51pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/14 "2021-08-02T15:51:20Z")

</div>

i will try with full path on include… and i’ll let you know… thanks

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [August 2, 2021, 6:07pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/15 "2021-08-02T18:07:36Z")

</div>

Try the 5.3.8.199 snapshot?

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 3, 2021, 1:42pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/16 "2021-08-03T13:42:29Z")

</div>

sorry to everybody i cannot test at the moment… having developers working hard on dev server…  
when they’ll finish i will give a try to both method… full path and snapshot…

---

<div class="post-metadata">

**Author:** ![scottdoc](https://dev.lucee.org/user_avatar/dev.lucee.org/scottdoc/32/3658_2.png) [@scottdoc](https://dev.lucee.org/u/scottdoc)\
**Post date:** [August 23, 2021, 11:54pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/17 "2021-08-23T23:54:41Z")

</div>

Hello - I am not sure if I should create a new topic or not, but I am finding a similar problem. A NPE inside cfthread. I have upgraded to the latest production release 5.3.8.201 and the problem still persists.

I have found that I am getting a NullPointerException when using a custom tag inside a cfthread when the main page request has finished.

I can give you some simple code examples to recreate.

I have a customTag directory in the root of our application and it’s mapping is defined in the /lucee/admin/server.cfm page. I have create a trivial file in there called dollar.cfm

```auto
<cfif thisTag.executionMode is 'start'>
	<cfparam name='attributes.value' type='string' default='0'>
	<cfoutput>#DollarFormat(val(attributes.value))#</cfoutput></cfif>

```

Then I have a test page that runs:

```auto
<!--- This works --->
<cfoutput><cf_dollar value="100" /></cfoutput><br />

<!--- This will throw an error into the systemOut --->
<cfthread action="run" type="daemon">
    <cfset y = 55 />
    <cfset systemOutput("Sleeping 3 sec ...", true) />
    <cfset sleep(3000) />
    <cfset systemOutput("Awake", true) />
    <cftry>
        <cfsavecontent variable="x">
            <!--- <cfmodule template="/customTags/dollar.cfm" value="#y#"> If I use this instead, it will not error --->
            <cf_dollar value="#y#" />
        </cfsavecontent>
        <cfset systemOutput("x: #x#", true) />
        <cfcatch type="any">
            <cfset systemOutput(cfcatch, true) />
        </cfcatch>
    </cftry>
</cfthread>

Done ...
<!--- If I uncomment this, I do not get the NPE --->
<!--- <cfset threadJoin() /> --->

```

So the NPE only really happens if the main page request finishes (that is why the 3 second sleep in there)

---

<div class="post-metadata">

**Author:** ![cfmitrah](https://dev.lucee.org/user_avatar/dev.lucee.org/cfmitrah/32/140_2.png) [@cfmitrah](https://dev.lucee.org/u/cfmitrah)\
**Post date:** [August 24, 2021, 7:05am UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/18 "2021-08-24T07:05:20Z")

</div>

Yes, this is regression in lucee latest versions and its start from 5.3.8.12-SNAPSHOT onwards. Can you file a bug here [https://luceeserver.atlassian.net](https://luceeserver.atlassian.net) ?

---

<div class="post-metadata">

**Author:** ![scottdoc](https://dev.lucee.org/user_avatar/dev.lucee.org/scottdoc/32/3658_2.png) [@scottdoc](https://dev.lucee.org/u/scottdoc)\
**Post date:** [August 24, 2021, 11:06pm UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/19 "2021-08-24T23:06:47Z")

</div>

No problem. Issue created: [[LDEV-3689] - Lucee](https://luceeserver.atlassian.net/browse/LDEV-3689)

Thanks

---

<div class="post-metadata">

**Author:** ![Falcone](https://dev.lucee.org/user_avatar/dev.lucee.org/falcone/32/3591_2.png) [@Falcone](https://dev.lucee.org/u/Falcone)\
**Post date:** [August 25, 2021, 9:40am UTC](https://dev.lucee.org/t/cfthread-nullpointerexception/8679/20 "2021-08-25T09:40:52Z")

</div>

hello everybody  
also for us… in 5.3.8.201 the problem still persist…
