<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: PingTimerTask in JBoss AS 5.0.1.GA EAP
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/kevin.lohmann">Kevin Lohmann</a> in <i>JBoss Remoting</i> - <a href="http://community.jboss.org/message/560203#560203">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi there again,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've created a simple standalone-client-scenario to reproduce the above warnings:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">public class TestScenario {

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

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

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

&#160;&#160;&#160;&#160;&#160;&#160;&#160; log("...ready!");
&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160; }

&#160;&#160;&#160; /**
&#160;&#160;&#160;&#160; * @throws NamingException 
&#160;&#160;&#160;&#160; */
&#160;&#160;&#160; private static void doIteration() throws NamingException {

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

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

&#160;&#160;&#160;&#160;&#160;&#160;&#160; log("...ready!");

&#160;&#160;&#160; }

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

&#160;&#160;&#160; }

&#160;&#160;&#160; private static void log(String pLog) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(sDATE_FORMATER.format(new Date()) + Thread.currentThread().getName() + pLog);
&#160;&#160;&#160; }
&#160;&#160;&#160; 
}</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This will create <em>${sCONCURRENT_CALLS}</em> daemon threads. Each thread gets a jms connectionfactory, creates a connection and closes the connection. The main thread will sleep <em>${sSLEEP_TIME}</em> milli seconds before terminating.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>With the above config, I receive everytime the following ConcurrentModificationException within the client:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">Exception in thread "Thread-1" java.util.ConcurrentModificationException
&#160;&#160;&#160; at java.util.WeakHashMap$HashIterator.nextEntry(WeakHashMap.java:762)
&#160;&#160;&#160; at java.util.WeakHashMap$KeyIterator.next(WeakHashMap.java:795)
&#160;&#160;&#160; at org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate$FinalizerShutdownHook.run(ClientClusteredConnectionFactoryDelegate.java:462)</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In server.log the following can be seen:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">2010-09-02 11:57:05,510 WARN&#160; [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
&#160;&#160;&#160; at java.net.SocketOutputStream.socketWrite0(Native Method)
&#160;&#160;&#160; at java.net.SocketOutputStream.socketWrite(Unknown Source)
&#160;&#160;&#160; at java.net.SocketOutputStream.write(Unknown Source)
&#160;&#160;&#160; at org.jboss.remoting.transport.bisocket.BisocketClientInvoker$PingTimerTask.run(BisocketClientInvoker.java:723)
&#160;&#160;&#160; at java.util.TimerThread.mainLoop(Unknown Source)
&#160;&#160;&#160; 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
&#160;&#160;&#160; at java.net.SocketOutputStream.socketWrite0(Native Method)
&#160;&#160;&#160; at java.net.SocketOutputStream.socketWrite(Unknown Source)
&#160;&#160;&#160; at java.net.SocketOutputStream.write(Unknown Source)
&#160;&#160;&#160; at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
&#160;&#160;&#160; at java.io.BufferedOutputStream.flush(Unknown Source)
&#160;&#160;&#160; at java.io.DataOutputStream.flush(Unknown Source)
&#160;&#160;&#160; at org.jboss.jms.wireformat.NullResponse.write(NullResponse.java:53)
&#160;&#160;&#160; at org.jboss.jms.wireformat.JMSWireFormat.write(JMSWireFormat.java:237)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.versionedWrite(ServerThread.java:1051)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:807)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:721)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:575)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)

</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I assume, these warnings and errors occur because the clients brake away. Can anyone confirm this?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,</p><p> Kevin</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/560203#560203">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Remoting at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2050">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>