tracker issue : CF-4203450

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

ObjectLoad() Component Never Garbage Collects / ObjectLoad() = Memory Leak

| View in Tracker

Status/Resolution/Reason: Open//

Reporter/Name(from Bugbase): Dave DeVol / ()

Created: 11/09/2018

Components: Core Runtime

Versions: 2016

Failure Type: Memory Leak

Found In Build/Fixed In Build: 2016 /

Priority/Frequency: Normal / All users will encounter

Locale/System: ALL / Win 2016

Vote Count: 4

<cfscript>
	setting requesttimeout=600;
	function testObjectLoadSave() {
		var itemCount = 1000;
		var thingMap = {};
		for (var i=0; i<itemCount; i++) {
			var thing = new thing();
			thing.setId(i);
			thing.setName("Thing " & i);
			thingMap[i] = ToBase64(ObjectSave(thing)); // what we store in Redis
		}
		for (var i=0; i<itemCount; i++) {
			var cached = thingMap[i]; // what we get back from Redis
			var thing = ObjectLoad(ToBinary(cached)); // comment this out and it will not eat up memory
			// WriteDump(thing);
		}
		// WriteDump(thingMap);
	}
	start = GetTickCount();
	loopCount = 1000;
	for (i=0; i<loopCount; i++) {
		testObjectLoadSave();
	}
	end = GetTickCount();
</cfscript>

Attachments:

Comments:

ObjectLoad() Component Never Garbage Collects / ObjectLoad() = Memory Leak Using ColdFusion 2016 Update 7. Running jdk1.8.0_172.We were caching components in ehCache (in-process) without any issues. We recently started using Redis for some of our caches. We were able to convert to Redis by saving serialized objects (queries, strings, structs, etc) and deserializing them. However; when we launched the first large project using components, it all worked (except our memory was climbing and climbing and never going down). I was able to determine it was something related to using ObjectLoad() on ObjectSave()ed components.
Comment by Dave DeVol
29918 | November 09, 2018 11:38:12 PM GMT
At this point, I'm pretty sure that the memory consumption is somehow caused by the implementation of CFCs. (I work with Dave. He is our CTO.) When I identified this problem earlier, I thought it was a problem with ObjectLoad(), specifically for components. I'm able to ObjectSave() and ObjectLoad() millions of strings and the JVM memory barely moves. I'm also able to just ObjectSave() (but not Load) millions of components. The problem happens when I ObjectLoad(cachedComponentBinary). Since we thought maybe it was ObjectLoad, I decided to look at how Java serializes and deserializes Java objects. I ended up writing a function called MyObjectLoad(). I have attached it to the issue. It does exactly what ObjectLoad() should do. I can serialize a query or component and turn it exactly back into a query or component. I did my tests again with that new function. The results were exactly the same. I was able to consume gigs of RAM in a short period of time. And it was never GCed. The documentation says ObjectLoad: > Loads a serialized ColdFusion array, *CFC*, DateTime object, Java object, query, or structure into memory as the corresponding object. We are using a feature as advertised. It is causing our servers to entirely run out of RAM.
Comment by Chris Phillips
29919 | November 10, 2018 03:31:56 AM GMT