RE: Client not stopping gracefully intermittely

Vikas Chopra <vvchop-/[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
We are facing the same problem also. We were using
0.7.6.1 and everything was well, but when we moved to
0.7.7-alpha-3, our appserver process is not shutting
down gracefully, looks like some thread is in a hung
state. We are using Tomcat 5.5.12.   Even creating a
topic without a connection is causing the same
problem.

Please tell me, what should I do to resolve that.

    /**
     * Initializes the Topic if not there create the
Topic
     * @throws JMSException
     * @throws MalformedURLException
     */
    public void initializeTopic() throws
MalformedURLException, JMSException {
        String topicName = schemaName + "_Topic";
        String providerURL = "rmi://" + hostname + ":"
+ portNumber + "/";

        JmsAdminServerIfc admin =
AdminConnectionFactory.create(providerURL);
        if (!admin.addDestination(topicName,
Boolean.FALSE)) {
            logger.info("Topic : " + topicName
                        + " already exists, ignoring
that ...");
        admin.close();
        }


Vikas




--- Tim Anderson <[email protected]> wrote:

> Try closing the JNDI context (Context.close()) after
> you've finished with
> it.
> It may be holding onto a connection.
> 
> -Tim 
> 
> > From: Ninju Bohra
> > 
> > Hello all,
> > 
> > We had using 0.7.6.1 and all was reasonable well,
> but when we moved to
> > 0.7.7-alpha-3 (to get the fix to bug #1214292) we
> are now 
> > having an issue that our client applications are
> not closing 
> > gracefully 90% of the time.
> > 
> > The openJMS client is a Tomcat 5.5.12 webapp and
> we are using JDK
> > 1.5.0_04-b05 on a WinXP (SP2) box.  When we ask
> Tomcat to 
> > STOP, the web server stops, however the process
> does not exit 
> > due to some non-deamon threads still running. 
> Some of the 
> > threads remaining are named "RMI Reaper", "Clock
> Daemon",  
> > "ManagedConnectionReaper1" and others.
> > 
> > We are using the openJMS in a non-persistent
> non-durable 
> > publisher/subscriber mode with the embedded RMI.
> > 
> > Here is the code that is used to start the
> connection:
> > 
> >     private void initalizeJMSConnection() throws 
> > NamingException, JMSException {
> >         String topicName = schemaName + "_Topic";
> >         String providerURL = "rmi://" + hostname +
> ":" + 
> > portNumber + "/";
> >        
> properties.put(Context.INITIAL_CONTEXT_FACTORY,
> >                       
> "org.exolab.jms.jndi.InitialContextFactory");
> >         properties.put(Context.PROVIDER_URL,
> providerURL);
> >         logger.info("Trying to listen to the
> connection named 
> > '" + topicName
> >                     + "' on the connectionFactory
> called '"
> >                     + connectionFactoryName
> >                     + "' hosted on JMS located at
> '"
> >                     + providerURL);
> >         Context jndiContext = new
> > javax.naming.InitialContext(properties);
> >         connectionFactory =
> (TopicConnectionFactory) 
> > jndiContext.lookup(connectionFactoryName);
> >         Topic dest = (Topic)
> jndiContext.lookup(topicName);
> >         connection =
> connectionFactory.createTopicConnection();
> >         session =
> connection.createTopicSession(false,
> > Session.AUTO_ACKNOWLEDGE);
> >         subscriber =
> session.createSubscriber(dest);
> >         subscriber.setMessageListener(this);
> >         connection.setExceptionListener(this);
> >         connection.start();
> >         logger.info("JMS Connection setup
> properly");
> >      }
> > 
> > 
> > And here is the code to stop/close the connection:
> > 
> >     public void stopListening() throws
> JMSException {
> >         if (connection != null) {
> >             connection.stop();
> >         }
> >         if (subscriber != null) {
> >             subscriber.close();
> >         }
> >         if (session != null) {
> >             session.close();
> >         }
> >         if (connection != null) {
> >             connection.close();
> >         }
> >     }
> > 
> > When the tomcat process does NOT gracefully stop,
> I do a 
> > Ctrl-Break and get the follow thread dump:
> > 
> > Mar 21, 2006 4:00:45 PM
> org.apache.coyote.http11.Http11BaseProtocol
> > destroy
> > INFO: Stopping Coyote HTTP/1.1 on http-30080 Mar
> 21, 2006 
> > 4:01:20 PM
> org.apache.catalina.loader.WebappClassLoader
> > loadClass
> > INFO: Illegal access: this web application
> instance has been 
> > stopped already.  Could not load 
> > resoft.framework.memento.MementoContext$1. 
> > The eventual following stack trace is caus ed by
> an error 
> > thrown for debugging purposes as well as to
> attempt to 
> > terminate the thread which caused the illegal
> access, and has 
> > no functional impact.
> > Mar 21, 2006 10:01:20 PM
> > resoft.framework.appsvr.sessionmgmt.AppSessionCtx
> finalize
> > INFO: ...AppSessionCtx.finalize()
> > Mar 21, 2006 4:01:20 PM
> org.apache.catalina.loader.WebappClassLoader
> > loadClass
> > INFO: Illegal access: this web application
> instance has been 
> > stopped already.  Could not load 
> > resoft.framework.memento.MementoContext$1. 
> > The eventual following stack trace is caus ed by
> an error 
> > thrown for debugging purposes as well as to
> attempt to 
> > terminate the thread which caused the illegal
> access, and has 
> > no functional impact.
> > Mar 21, 2006 4:01:20 PM
> org.apache.catalina.loader.WebappClassLoader
> > loadClass
> > INFO: Illegal access: this web application
> instance has been 
> > stopped already.  Could not load 
> >
>
org.exolab.jms.net.connector.DefaultConnectionPool$IdleReaper.
> >   The eventual following  stack trace is caused by
> an error 
> > thrown for debugging purposes as well as to
> attempt to 
> > terminate the thread which caused the illegal
> access, and has 
> > no functional impact.
> > Mar 21, 2006 4:01:20 PM
> org.apache.catalina.loader.WebappClassLoader
> > loadClass
> > INFO: Illegal access: this web application
> instance has been 
> > stopped already.  Could not load 
> >
>
org.exolab.jms.net.connector.DefaultConnectionPool$IdleReaper.
> >   The eventual following  stack trace is caused by
> an error 
> > thrown for debugging purposes as well as to
> attempt to 
> > terminate the thread which caused the illegal
> access, and has 
> > no functional impact.
> > Full thread dump Java HotSpot(TM) Client VM
> (1.5.0_04-b05 mixed mode):
> > 
> > "DestroyJavaVM" prio=5 tid=0x00038220 nid=0x151c
> waiting on 
> > condition [0x00000000..0x0007fae8]
> > 
> > "TP-Processor4" daemon prio=5 tid=0x2c6c85f0
> nid=0x1458 in
> > Object.wait() [0x2db6f000..0x2db6fae8]
> >         at java.lang.Object.wait(Native Method)
> >         - waiting on <0x06004ba8> (a
> > org.apache.jk.common.ChannelSocket)
> >         at java.lang.Object.wait(Object.java:474)
> >         at
> >
>
org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:287)
> >         - locked <0x06004ba8> (a
> org.apache.jk.common.ChannelSocket)
> >         at
> >
>
org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSo
> > cket.java:637)
> >         at
> >
>
org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(Channe
> > lSocket.java:847)
> >         at
> >
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.java:684)
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.