[jboss-user] [JBoss Remoting] - Re: PingTimerTask in JBoss AS 5.0.1.GA EAP

Kevin Lohmann do-not-reply at jboss.com
Thu Sep 2 06:01:34 EDT 2010


Kevin Lohmann [http://community.jboss.org/people/kevin.lohmann] created the discussion

"Re: PingTimerTask in JBoss AS 5.0.1.GA EAP"

To view the discussion, visit: http://community.jboss.org/message/560203#560203

--------------------------------------------------------------
Hi there again,

I've created a simple standalone-client-scenario to reproduce the above warnings:


public class TestScenario {

    // ############### CONFIG #################
    private final static String sJMS_CONNECTION_FACTORY_NAME = "ClusteredConnectionFactory";
    private final static int sCONCURRENT_CALLS = 25;
    private final static long sSLEEP_TIME = sCONCURRENT_CALLS * 100;
    // ########################################
    
    private final static CountDownLatch sCDL = new CountDownLatch(sCONCURRENT_CALLS);
    private final static SimpleDateFormat sDATE_FORMATER = new SimpleDateFormat("HH:mm:ss.SSS ");
    
    public static void main(String[] args) {

        for (int i = 0; i < sCONCURRENT_CALLS; i++) {
            final int lIteration = i;
            Thread lThread = new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        doIteration();
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                }
            }, "Thread-no." + lIteration);
            lThread.setDaemon(true);
            lThread.start();
        }

        try {
            Thread.sleep(sSLEEP_TIME);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log("...ready!");
        
    }

    /**
     * @throws NamingException 
     */
    private static void doIteration() throws NamingException {

        log("...lookup JMSConnectionFactory...");
        ConnectionFactory lConnectionFactory = lookUpJMSConnectionFactory();

        sCDL.countDown();
        
        Connection lConnection;
        try {
            log("...create JMSConnection...");
            lConnection = lConnectionFactory.createConnection();
            log("...close JMSConnection...");
            lConnection.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }

        log("...ready!");

    }

    /**
     * @return
     * @throws NamingException 
     */
    private static ConnectionFactory lookUpJMSConnectionFactory() throws NamingException {
        Context lContext = new InitialContext();
        return (ConnectionFactory) lContext.lookup(sJMS_CONNECTION_FACTORY_NAME);

    }

    private static void log(String pLog) {
        System.out.println(sDATE_FORMATER.format(new Date()) + Thread.currentThread().getName() + pLog);
    }
    
}

This will create +${sCONCURRENT_CALLS}+ daemon threads. Each thread gets a jms connectionfactory, creates a connection and closes the connection. The main thread will sleep +${sSLEEP_TIME}+ milli seconds before terminating.

With the above config, I receive everytime the following ConcurrentModificationException within the client:

Exception in thread "Thread-1" java.util.ConcurrentModificationException
    at java.util.WeakHashMap$HashIterator.nextEntry(WeakHashMap.java:762)
    at java.util.WeakHashMap$KeyIterator.next(WeakHashMap.java:795)
    at org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate$FinalizerShutdownHook.run(ClientClusteredConnectionFactoryDelegate.java:462)

In server.log the following can be seen:

2010-09-02 11:57:05,510 WARN  [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] (Timer-4) Unable to send ping: shutting down PingTimerTask
java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(Unknown Source)
    at java.net.SocketOutputStream.write(Unknown Source)
    at org.jboss.remoting.transport.bisocket.BisocketClientInvoker$PingTimerTask.run(BisocketClientInvoker.java:723)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

And:

2010-09-02 11:56:59,401 ERROR [org.jboss.remoting.transport.socket.ServerThread] (WorkerThread#40[10.3.4.124:4488]) WorkerThread#40[10.3.4.124:4488] failed
java.io.IOException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(Unknown Source)
    at java.net.SocketOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at java.io.DataOutputStream.flush(Unknown Source)
    at org.jboss.jms.wireformat.NullResponse.write(NullResponse.java:53)
    at org.jboss.jms.wireformat.JMSWireFormat.write(JMSWireFormat.java:237)
    at org.jboss.remoting.transport.socket.ServerThread.versionedWrite(ServerThread.java:1051)
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:807)
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:721)
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:575)
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)



I assume, these warnings and errors occur because the clients brake away. Can anyone confirm this?

Thanks,
 Kevin
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/560203#560203]

Start a new discussion in JBoss Remoting at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2050]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100902/bc3b465d/attachment-0001.html 


More information about the jboss-user mailing list