tracker issue : CF-4197116

select a category, or use search below
(searches all categories and all time range)

Unexpected behaviour from setLocale when used inside cfthread

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Mingo Hagen / Mingo Hagen (Mingo Hagen)

Created: 10/27/2016

Components: Language

Versions: 2016,11.0,10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Final / 311460

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 2

Problem Description:

Having setLocale() in a cfthread can throw a NullPointerException errors at (seemingly) random intervals or simply not work.

I have tested with CF9, CF10, CF11 and CF2016.

Steps to Reproduce:

Run attached code a couple times and tail the sscce.log

I've seen it work as expected, throw NPEs, or not working at all. I can't really tell when it does what.

Actual Result:

Random errors or not working as documented.

Expected Result:

setLocale should work inside a cfthread.

Any Workarounds:

Don't use setLocale() inside a cfthread

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4197116

Reason:	BugVerified

External Customer Info:
External Company:  
External Customer Name: Mingo Hagen
External Customer Email:  
External Test Config: My Hardware and Environment details:

I've seen this behavior in the developer versions of CF11 and CF2016 installed on Windows 10 and on CF9 on Windows Server 2008.

Also on CF10, CF11 and CF2016 on CommandBox running on Windows 10.


  1. October 27, 2016 00:00:00:


+1 - I've verified setLocale() within cfthread sometimes throws exceptions
Vote by External U.
1576 | October 29, 2016 01:49:35 AM GMT
Confirmed exceptions are thrown. With JMeter, I always saw the following error, on CF10/11/2016 on 2 machines: java.lang.NullPointerException at org.apache.catalina.connector.Response.setLocale( at org.apache.catalina.connector.ResponseFacade.setLocale( at javax.servlet.ServletResponseWrapper.setLocale( at coldfusion.jsp.ServletResponseWrapper.setLocale( at coldfusion.jsp.ServletResponseWrapper.setLocale( at coldfusion.runtime.CFPage.SetLocale( at -Except- for -CF11-, on -one- machine, always threw the following error instead: java.lang.IllegalStateException: The response object has been recycled and is no longer associated with this facade at org.apache.catalina.connector.ResponseFacade.getLocale( at javax.servlet.ServletResponseWrapper.getLocale( at coldfusion.jsp.ServletResponseWrapper.getLocale( at coldfusion.jsp.ServletResponseWrapper.getLocale( at coldfusion.runtime.locale.CFLocaleMgr.getLocaleObj( at coldfusion.runtime.CFPage.GetLocaleObj( at coldfusion.runtime.CFPage.GetLocale( at coldfusion.runtime.CFPage.SetLocale( When I would just repeatedly F5 the page, instead of using JMeter, I'd get various other errors like these: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification( at java.util.ArrayList$ at at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.runtime.CFPage.SetLocale( java.lang.NullPointerException at org.apache.tomcat.util.http.MimeHeaders.setValue( at org.apache.coyote.Response.setHeader( at org.apache.catalina.connector.Response.setHeader( at org.apache.catalina.connector.ResponseFacade.setHeader( at javax.servlet.http.HttpServletResponseWrapper.setHeader( at at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.runtime.CFPage.SetLocale( java.lang.NullPointerException at at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.jsp.HttpServletResponseWrapper.setHeader( at coldfusion.runtime.CFPage.SetLocale( Thanks!, -Aaron
Comment by External U.
1574 | October 29, 2016 01:53:07 AM GMT
Verified it on CF2016 with update 3, ran the attached test case using JMeter. I could see there are few NPEs at random intervals. Attaching the log file
Comment by HariKrishna K.
1575 | November 09, 2016 12:47:53 AM GMT
Is this one going to get a fix in CF2016?
Comment by Mingo H.
31784 | November 07, 2019 02:03:23 PM GMT
This is marked as fixed - please confirm which updater / hotfix this was fixed in and for which CF versions. Thank you :)
Comment by John W.
31785 | November 07, 2019 02:08:38 PM GMT
I just confirmed I'm no longer getting these errors in CF2016 update 12, but this bug is not mentioned in the release notes for that version. I was still getting the errors in update 11.
Comment by Mingo H.
31786 | November 07, 2019 03:22:16 PM GMT