tracker issue : CF-3263093

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

Exception in onApplicationStart causes a leak of org.hibernate.impl.SessionFact¬ory.Impl

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): david ames / david ames (david ames)

Created: 07/08/2012

Components: Performance

Versions: 9.0.1

Failure Type: Memory Leak

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win 2008 Server x64

Vote Count: 5

Problem Description:
If there is an exception in the onApplicationStart event in application.cfc, every time the application attempts to load, 1 instance of org.hibernate.impl.SessionFact¬ory.Impl is created and never cleaned up. IE, a classic memory leak.

This means that on a server with multiple applications, 1 application can crash the entire server.


Steps to Reproduce:

Create a new application based on the following:

<cfcomponent>
	<cfscript>			
		this.name = 'MemoryLeak';				
		this.ormenabled = true;
		this.dataSource = 'SomeDataSource';
		this.ormsettings.cfclocation = expandPath("model");		
		this.ormsettings.eventhandling=true;
		this.ormSettings.flushatrequestend = false;
		this.ormSettings.automanagesession = true;
	</cfscript>
	
	<cffunction name="onApplicationStart" access="public" returntype="boolean" output="false">		
		<cfthrow message="This will cause a memory leak" />		
	</cffunction>
</cfcomponent>

Point a copy of Apache JMeter at it, use JVisualVM to keep an eye on the heap - you will see that the number of instances of org.hibernate.impl.SessionFact¬ory.Impl  climbs rapidly, eventually crashing the server.


Actual Result:
Server crash with GC Overhead limit exceeded.

Expected Result:
Server should not crash.

Any Workarounds:

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

Watson Bug ID:	3263093

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

Attachments:

Comments:

Class is org.hibernate.impl.SessionFactory.Impl
Comment by External U.
18759 | July 08, 2012 03:22:02 PM GMT
Having the exact same problem! Leaking memory like it's going out of fashion.
Vote by External U.
18761 | July 08, 2012 03:23:18 PM GMT
+1 can also confirm we have this same problem. Restarting is OK on servers running a single application, but on ones running multiple it is an absolute nightmare.
Vote by External U.
18762 | July 08, 2012 03:26:01 PM GMT
Yep, took me a while to track it down but this needs a fix....
Vote by External U.
18763 | July 08, 2012 03:27:02 PM GMT
Well, this bug explains a lot. We've had a number of server memory issues and it came down to the same issue.
Vote by External U.
18764 | July 08, 2012 05:16:31 PM GMT
When orm is enabled and onApplicationStart aborts or has an exception, the number of threads increases until the server is unresponsive.
Vote by External U.
18765 | October 08, 2012 05:28:44 AM GMT
This issue is fixed in ColdFusion 10.
Comment by Nimit S.
18760 | February 19, 2014 08:11:18 AM GMT