tracker issue : CF-4099820

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

WeakHashMap in coldfusion.runtime.java.ReflectionCache.java in cfusion.jar is not thread safe and can cause infinite loops

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Bob Albright / Bob Albright (Bob Albright)

Created: 12/14/2015

Components: Core Runtime

Versions: 11.0

Failure Type: Crash

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: ALL / Win 2012 Server x64

Vote Count: 1

Listed in the version 2016.0.03.300466 Issues Fixed doc
Problem Description:

The WeakHashMap (variable name classCache) in coldfusion.runtime.java.ReflectionCache is not safe to use across multiple threads at once (similar to most Map objects in java.util.*).  There are concurrency situations that can cause data internal to the HashMap to get corrupted and lead to 100% CPU usage for get operations.  The specifics for this to happen (multiple resize operations at once) are complicated.  This blog post (http://mailinator.blogspot.com/2009/06/beautiful-race-condition.html) does a good job describing what causes this problem.

Also note that this bug is similar to issue number 3295469 (https://bugbase.adobe.com/index.cfm?event=bug&id=3295469).

Attachment details:
* cpu_pegged_stacktrace.txt - this is a jstack thread dump from one of our servers after it got into a 100% CPU usage scenario
* ReflectionCache.java - this is the .class file from cfusion.jar that contains a bug
* ReflectionCache_suggestedChange.java - I believe that this is the change you need to make to this code to fix the problem
* cf8 folder
** I have attached some additional context for how this class was implemented in ColdFusion 8.  In ColdFusion 8, this class was implemented significantly differently and it appears that a lot of thought was put into handling concurrency situations (CF8 used "coldfusion.util.SoftCache) instead of the WeakHashMap.


Steps to Reproduce:
No known ways to easily reproduce the problem.  We have hit this approximately once a week for the last month or so across ~10 ColdFusion instances.  I was not able to setup a simple example that gets into a 100% CPU utilization situation.


Actual Result:
100% CPU utilization and requests don't complete.  The server must be restarted after it gets into a 100% CPU state.


Expected Result:
Requests process normally.


Any Workarounds:
No.

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

Watson Bug ID:	4099820

External Customer Info:
External Company:  
External Customer Name: Bob Albright
External Customer Email:  
External Test Config: My Hardware and Environment details:

Not applicable

Attachments:

  1. December 14, 2015 00:00:00: 1_WeakHashMap_concurrency_bug.zip

Comments:

Debugging this issue required a variety of low-level tools and has yet again delayed our attempts to upgrade to ColdFusion 11.
Vote by External U.
5104 | December 14, 2015 11:06:03 AM GMT
This issue is fixed now. The fix for this issue will be available as part of an upcoming update of ColdFusion.
Comment by Nimit S.
5103 | August 09, 2016 12:34:20 AM GMT