tracker issue : CF-4197116

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

Unexpected behaviour from setLocale when used inside cfthread

| View in Tracker

Status/Resolution/Reason: To Test//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 /

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.

Attachments:

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

Comments:

+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(Response.java:913) at org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:357) at javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:196) at coldfusion.jsp.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:74) at coldfusion.jsp.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:74) at coldfusion.runtime.CFPage.SetLocale(CFPage.java:5435) 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(ResponseFacade.java:365) at javax.servlet.ServletResponseWrapper.getLocale(ServletResponseWrapper.java:205) at coldfusion.jsp.ServletResponseWrapper.getLocale(ServletResponseWrapper.java:38) at coldfusion.jsp.ServletResponseWrapper.getLocale(ServletResponseWrapper.java:38) at coldfusion.runtime.locale.CFLocaleMgr.getLocaleObj(CFLocaleMgr.java:199) at coldfusion.runtime.CFPage.GetLocaleObj(CFPage.java:5406) at coldfusion.runtime.CFPage.GetLocale(CFPage.java:5330) at coldfusion.runtime.CFPage.SetLocale(CFPage.java:5419) 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(ArrayList.java:819) at java.util.ArrayList$Itr.next(ArrayList.java:791) at coldfusion.tagext.io.cache.ehcache.GenericResponseWrapper.setHeader(GenericResponseWrapper.java:196) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.runtime.CFPage.SetLocale(CFPage.java:5093) java.lang.NullPointerException at org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:304) at org.apache.coyote.Response.setHeader(Response.java:316) at org.apache.catalina.connector.Response.setHeader(Response.java:1452) at org.apache.catalina.connector.ResponseFacade.setHeader(ResponseFacade.java:534) at javax.servlet.http.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:164) at coldfusion.tagext.io.cache.ehcache.GenericResponseWrapper.setHeader(GenericResponseWrapper.java:209) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.runtime.CFPage.SetLocale(CFPage.java:5093) java.lang.NullPointerException at coldfusion.tagext.io.cache.ehcache.GenericResponseWrapper.setHeader(GenericResponseWrapper.java:198) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.jsp.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:73) at coldfusion.runtime.CFPage.SetLocale(CFPage.java:5436) 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