Discussion:
[openjms-developer] [ openjms-Bugs-1689845 ] Client shutdown problem
SourceForge.net
2007-04-25 14:19:36 UTC
Permalink
Bugs item #1689845, was opened at 2007-03-28 22:46
Message generated for change (Comment added) made by tanderson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1689845&group_id=54559

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: client
Group: v0.7.7-alpha-3
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jan Dittberner (jandd)
Assigned to: Tim Anderson (tanderson)
Summary: Client shutdown problem

Initial Comment:
We have an OpenJMS-Client integrated in a web application. The OpenJMS connection is created and closed in an own JMSManager class which is started and stopped in a ServletContextListener. When starting the ServletContext we perform:

// initialize JNDI-Context
context = new InitialContext(cxtEnv);
// get connection
topicConnection = ((TopicConnectionFactory) context.lookup(factoryKeyTopic)).createTopicConnection();
topicConnection.start();
// create a QueueSession
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

on shutdown we do:

topicSession.close();
topicConnection.close();
context.close();

If the servlet container (Tomcat 5.5) is shut down the ClockDaemon from DefaultConnectionPool stays alive. After some seconds a NullPointerException is thrown. The tomcat process never stops. The following Stacktrace is logged:

Exception in thread "ManagedConnectionReaper1" java.lang.NullPointerException
at org.apache.log4j.LogManager.getLogger(LogManager.java:188)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229)
at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
at org.exolab.jms.net.connector.DefaultConnectionPool$IdleReaper.run(DefaultConnectionPool.java:644)
at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Log4J may not be available after the ServletContext is shutdown.

The following threads keep running:

org.apache.catalina.startup.Bootstrap at localhost:2738
Thread [Clock Daemon] (Running)
Thread [Timer-1] (Running)
Thread [http-8080-Processor25] (Running)
Thread [TP-Processor4] (Running)
Thread [DestroyJavaVM] (Running)


----------------------------------------------------------------------
Comment By: Tim Anderson (tanderson)
Date: 2007-04-26 00:19

Message:
Logged In: YES
user_id=557161
Originator: NO

When the last reference to the physical connection to the server is
released, a reaper thread will be started to reap the connection.
This starts approximately 5 seconds after the reference is released and
closes the connection if it hasn't been subsequently used.

You may be able to work round the NullPointerException by adding a sleep
in the ServletContextListener to try and ensure that tomcat doesn't unload
resources until the DefaultConnectionPool has completed reaping.

Also note that of the above threads, only [Clock Daemon] belongs to
OpenJMS, and is a daemon thread - it won't prevent tomcat shutting down.

----------------------------------------------------------------------

Comment By: Jan Dittberner (jandd)
Date: 2007-04-12 01:16

Message:
Logged In: YES
user_id=32700
Originator: YES

I tried 0.7.7-beta-1 and the problem still occurs.

----------------------------------------------------------------------

Comment By: Tim Anderson (tanderson)
Date: 2007-04-03 11:26

Message:
Logged In: YES
user_id=557161
Originator: NO

Have you tried 0.7.7-beta-1?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1689845&group_id=54559
Loading...