-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SessionFactoryImpl.close exception handling
PostPosted: Thu Dec 14, 2006 12:56 pm 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
I've come across the following problem after upgrading to ehcache-1.2.4:

http://sourceforge.net/forum/forum.php?thread_id=1624868&forum_id=322278

While the cause of the problem seems to be a race condition between the EHCache and JBoss JVM shutdown hooks, I'm wondering if the exception handling in SessionFactoryImpl.close might not be a little fragile.

It seems that Exceptions thrown from the CacheProvider closing/destroying isn't being caught, causing the ConnectionProvider not to be closed.

Please let me know if this warrants a JIRA issue.

Thanks,

Frank


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 11:54 am 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
I have created the following JIRA for this issue: http://opensource.atlassian.com/project ... e/HHH-2311

FYI, a bug has been filed against EHCache to request that the ShutdownHook be optionally disabled.
Here is the link: http://sourceforge.net/tracker/index.ph ... tid=603559


Top
 Profile  
 
 Post subject: SessionFactoryImpl.close exception handling
PostPosted: Wed Feb 14, 2007 5:17 am 
Newbie

Joined: Tue Oct 21, 2003 7:59 pm
Posts: 9
Hi

I am the maintainer of ehcache.

Ehcache has a ShutdownListener that can be added to a Web Context. This should mean that the

/**
* A ServletContextListener that shutsdown CacheManager. Use this when you want to shutdown
* ehcache automatically when the web application is shutdown. If the web application is in
* a VM which is being shutdown, the ehcache shutdown hooks will do the work and this class
* is not required.
* <p/>
* To receive notification events, this class must be configured in the deployment descriptor for the web application.
* To do so, add the following to web.xml in your web application:
* <pre>
* &lt;listener&gt;
* <listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
* &lt;/listener&gt;
* <p/>
* </pre>
*
* @author Daniel Wiell
* @author Greg Luck
* @version $Id: ShutdownListener.java 331 2007-01-29 09:38:41Z gregluck $
*/
public class ShutdownListener implements ServletContextListener {


The Shutdown Hook is a worst case for when ehcache is not shutdown. According to the JavaDoc, "A shutdown hook is simply an initialized but unstarted thread. When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently". The reason the ehcache shutdown thread was moved to CacheManager to reduce the number of them to one, which simplified thread management on shutdown.

Ehcache is tested on Tomcat and Orion (in automated integration tests) and Glassfish (production use) and works fine. We do not see these errors.

However I take the point. Because of the nature of shutdown hooks, you do want to be able to disable them. They are only really necessary when you have a persistent disk store, which is probably a minority use case. I have added a system property as suggested by Frank Grimes. Add the System property net.sf.ehcache.disableShutdownHook=true to disable the shutdown hook.

This change is in trunk and will be in ehcache-1.3 which will be out in a few weeks. 1.3 contains a new JMX package and a JCACHE implementation package. Existing packages are virtually unchanged, so if you are using features which existed in 1.2.4 it is a bug fix release.

Greg Luck


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.