7 Replies Latest reply on Mar 20, 2009 5:20 AM by jmesnil

    How to supress Netty connection exception logging

    timfox

      Everytime a netty connector fails to connect we get the following exception logged by Netty

      java.net.ConnectException: Connection refused
       at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
       at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:527)
       at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:322)
       at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:314)
       at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:243)
       at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:72)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      


      When a JBM cluster is starting up each node continuously tries to connect the other nodes, so we can end up with many thousands of these in the logs for normal startup.

      Is it possible for Netty not to log these exceptions? It makes it look like something has gone wrong with the system even though it's quite normal.

        • 1. Re: How to supress Netty connection exception logging
          trustin

          Perhaps it's being logged by exceptionCaught() handler method implementation somewhere in JBM2 like MessagingChannelHandler. Please ping me if this is not the case.

          • 2. Re: How to supress Netty connection exception logging
            timfox

            I can't see any logging in our handler.

            Also the logging looks like a System.out/err rather than log4j since it doesn't have the standard log4j information on the line.

            I did a search in both Netty and JBM source for System.out and System.err and can't find any relevent ones so I am baffled...

            • 3. Re: How to supress Netty connection exception logging
              timfox

              BTW to replicate just run NettySymmetricClusterTest in eclipse

              • 4. Re: How to supress Netty connection exception logging
                timfox

                FWIW I am pretty sure this only started happening when we upgraded Netty versions (although I am not 100% sure)

                • 5. Re: How to supress Netty connection exception logging
                  trustin

                  It's:

                  /src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java


                  I was able to locate more printStackTraces with the following shell cmd:

                  grep -ri printstacktrace . | egrep -v '(svn-base|/tests?/|/examples?/|\.settings|Binary)'


                  and here's the result:

                  [trustin@vault jboss-messaging]$ grep -ri printstacktrace . | egrep -v '(svn-base|/tests?/|/examples?/|\.settings|Binary)'
                  ./src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java: future.getCause().printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: exc.printStackTrace();
                  ./src/main/org/jboss/messaging/utils/Base64.java: exc.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/PairsInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/PairsInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java: e.printStackTrace(System.err);
                  ./src/main/org/jboss/messaging/core/management/TransportConfigurationInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/TransportConfigurationInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/MessageInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/MessageInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/PropertiesInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/management/PropertiesInfo.java: e.printStackTrace();
                  ./src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFileFactory.java: new Exception ("journalDir is null").printStackTrace();
                  ./src/main/org/jboss/messaging/core/journal/impl/JournalFileImpl.java: e.printStackTrace();


                  • 6. Re: How to supress Netty connection exception logging
                    timfox

                    Thanks Trustin, sorry to waste your time :)

                    The printStackTrace was added here:

                    Author: jmesnil
                    Date: 2009-02-26 12:10:04 -0500 (Thu, 26 Feb 2009)
                    New Revision: 5941
                    
                    Modified:
                     trunk/.classpath
                     trunk/build-thirdparty.xml
                     trunk/messaging.ipr
                     trunk/src/main/org/jboss/messaging/integration/transports/netty/HttpAcceptorHandler.java
                     trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
                     trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
                     trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
                    Log:
                    updated netty to 3.1.0.ALPHA4
                    
                    Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
                    ===================================================================
                    --- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2009-02-26 16:15:17 UTC (rev 5940)
                    +++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2009-02-26 17:10:04 UTC (rev 5941)
                    @@ -56,9 +56,9 @@
                     import org.jboss.netty.channel.ChannelPipelineCoverage;
                     import org.jboss.netty.channel.ChannelPipelineFactory;
                     import org.jboss.netty.channel.ChannelStateEvent;
                    -import org.jboss.netty.channel.DefaultMessageEvent;
                     import org.jboss.netty.channel.MessageEvent;
                     import org.jboss.netty.channel.SimpleChannelHandler;
                    +import org.jboss.netty.channel.UpstreamMessageEvent;
                     import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
                     import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory;
                     import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
                    @@ -371,6 +371,7 @@
                     }
                     else
                     {
                    + future.getCause().printStackTrace();
                     return null;
                    


                    Naughty people putting printStackTrace in the code! ;)

                    • 7. Re: How to supress Netty connection exception logging
                      jmesnil

                       

                      "timfox" wrote:

                      Naughty people putting printStackTrace in the code! ;)


                      Yeah! If only we could have a tool to know who are these people...
                      What? "svn blame"? who is "jmesnil"?
                      ... mmmh....errr.... ok, I've removed all these printStackTrace :)