Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 70661 invoked from network); 26 Oct 2010 15:06:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Oct 2010 15:06:41 -0000 Received: (qmail 78847 invoked by uid 500); 26 Oct 2010 15:06:38 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 78484 invoked by uid 500); 26 Oct 2010 15:06:37 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 78471 invoked by uid 99); 26 Oct 2010 15:06:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Oct 2010 15:06:37 +0000 X-ASF-Spam-Status: No, hits=2.9 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [62.149.158.32] (HELO smtplq01.aruba.it) (62.149.158.32) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 26 Oct 2010 15:06:31 +0000 Received: (qmail 27044 invoked by uid 89); 26 Oct 2010 15:06:07 -0000 Received: from unknown (HELO smtp4.aruba.it) (62.149.128.201) by smtplq01.aruba.it with SMTP; 26 Oct 2010 15:06:07 -0000 Received: (qmail 24504 invoked by uid 89); 26 Oct 2010 15:06:08 -0000 Received: from unknown (HELO ?10.0.0.35?) (s.suzzi@protesa.it@151.32.169.34) by smtp4.ad.aruba.it with SMTP; 26 Oct 2010 15:06:07 -0000 Subject: Re: Tomcat cluster error (null pointer except) on NioReceiver.java:266 From: Stefano Suzzi To: Tomcat Users List In-Reply-To: <1288020085.4615.16.camel@stslnx.localdomain> References: <1287742628.2374.61.camel@stslnx.localdomain> <1288020085.4615.16.camel@stslnx.localdomain> Content-Type: multipart/alternative; boundary="=-MbsunmAKv7WusJ3YUTCl" Date: Tue, 26 Oct 2010 17:06:07 +0200 Message-ID: <1288105567.3618.59.camel@stslnx.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) X-Spam-Rating: smtp4.ad.aruba.it 1.6.2 0/1000/N X-Spam-Rating: smtplq01.aruba.it 1.6.2 0/1000/N --=-MbsunmAKv7WusJ3YUTCl Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit In the post before I sed why accept() returns null, so i was investigating in tomcat and jdk_1.6 source code, and I found that the method accept in ServerSocketChannel.java can return null in case of non-blocking socket e no connection available. Should this be tested? and why ask for session replication when the connection is not established? plus, from the logs it looks like that later is not retry again to re-establish the connection. Anyway, it seems that in my production environment the request does not stay pending enough to be accepted, any suggestion about what I can check? Thanks. Stefano. Source: http://www.javakey.net/source/jdk/1.6/java/nio/channels/ServerSocketChannel.java.html I add the comment found in the api doc: Returns: The socket channel for the new connection, or null if this channel is in non-blocking mode and no connection is available to be accepted http://download.oracle.com/javase/6/docs/api/java/nio/channels/ServerSocketChannel.html#accept%28%29 NioReceiver.java snippet: -------------------------------------- 257 // get an iterator over the set of selected keys 258 Iterator it = selector.selectedKeys().iterator(); 259 // look at each key in the selected set 260 while (it.hasNext()) { 261 SelectionKey key = (SelectionKey) it.next(); 262 // Is a new connection coming in? 263 if (key.isAcceptable()) { 264 ServerSocketChannel server = (ServerSocketChannel) key.channel(); 265 SocketChannel channel = server.accept(); 266 channel.socket().setReceiveBufferSize(getRxBufSize()); catalina.out pieces: INFO: Starting Servlet Engine: Apache Tomcat/6.0.26 20-oct-2010 11:49:23 org.apache.catalina.ha.tcp.SimpleTcpCluster start INFO: Cluster is about to start 20-oct-2010 11:49:23 org.apache.catalina.tribes.transport.ReceiverBase bind INFO: Receiver Server Socket bound to:/10.75.64.205:4000 20-oct-2010 11:49:23 org.apache.catalina.tribes.membership.McastServiceImpl setupSocket INFO: Setting cluster mcast soTimeout to 500 20-oct-2010 11:49:23 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4 20-oct-2010 11:49:24 org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded INFO: Replication member added:org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 75, 64, 206}:4000,{10, 75, 64, 206},4000, alive=32137,id={-61 -37 107 -64 -44 -77 71 29 -102 -121 -88 16 -50 -54 43 97 }, payload={}, command={}, domain={}, ] 20-oct-2010 11:49:24 org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded INFO: Replication member added:org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 75, 64, 207}:4000,{10, 75, 64, 207},4000, alive=72301,id={-49 -8 114 -44 118 127 77 29 -78 104 101 -87 -73 62 -111 100 }, payload={}, command={}, domain={}, ] 20-oct-2010 11:49:24 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers INFO: Done sleeping, membership established, start level:4 20-oct-2010 11:49:24 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8 20-oct-2010 11:49:24 org.apache.catalina.tribes.transport.nio.NioReceiver listen GRAVE: Unable to process request in NioReceiver java.lang.NullPointerException at org.apache.catalina.tribes.transport.nio.NioReceiver.listen(NioReceiver.java:266) at org.apache.catalina.tribes.transport.nio.NioReceiver.run(NioReceiver.java:353) at java.lang.Thread.run(Thread.java:619) ........................ .......................... 20-oct-2010 11:49:26 org.apache.catalina.ha.session.DeltaManager getAllClusterSessions ADVERTENCIA: Gestor [localhost#/yadas], requiriendo estado de sesión desde org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 75, 64, 207}:4000,{10, 75, 64, 207},4000, alive=74309,id={-49 -8 114 -44 118 127 77 29 -78 104 101 -87 -73 62 -111 100 }, payload={}, command={}, domain={}, ]. Esta operación se agotará si no se recibe estado de sesión dentro de 60 segundos. 20-oct-2010 11:49:26 org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor report INFO: ThroughputInterceptor Report[ Tx Msg:1 messages Sent:0,00 MB (total) Sent:0,00 MB (application) Time:0,01 seconds Tx Speed:0,06 MB/sec (total) TxSpeed:0,06 MB/sec (application) Error Msg:0 Rx Msg:0 messages Rx Speed:0,00 MB/sec (since 1st msg) Received:0,00 MB] 20-oct-2010 11:50:26 org.apache.catalina.ha.session.DeltaManager waitForSendAllSessions GRAVE: Gestor [localhost#/yadas]: No se ha recibido estado de sesión a las 20/10/10 11:49, agotando tiempo tras 60.096 ms. Il giorno lun, 25/10/2010 alle 17.21 +0200, Stefano Suzzi ha scritto: > Hi, thanks for reply, > I was watching too the NioReceiver.java source code, and I was wondering > why server.accept() does not throw an exception instead null, mha!. > > The java version in production is 1.6.0_20 vendor Sun 64bit. > while in my devel environment is 1.6.0_11 vendor Sun 32bit. > > In catalina.out there is a line about the APR library that shows the > "java library path" that could be usefull : > java.library.path: /usr/java/jdk1.6.0_20/jre/lib/amd64/server:/usr/java/jdk1.6.0_20/jre/lib/amd64:/usr/java/jdk1.6.0_20/jre/../lib/amd64:/opt/CA/SharedComponents/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib > > Any Suggestion? > Stefano. > > > > Il giorno sab, 23/10/2010 alle 00.21 +0400, Konstantin Kolinko ha > scritto: > > > 2010/10/22 Stefano Suzzi : > > > > > > Hi, i've 3 tomcat 6.0.26 on 3 different IBM machines linux RedHat el > > > 5, kernel.osrelease = 2.6.18-194.el5 . > > > > > > The 3 tomcat are giving an error that cannot replicate the session, > > > of course I cannot replicate the error in my devel systems that work > > > perfectly with the same configuration. > > > In anycase I can access my web application but it works only locally. > > > > > > Here is the catalina.out with the error in red and the configuration > > > file server.xml > > > > > > any help is really appreciated. > > > > > > > Looking at the sources for NioReceiver.java:266 of TC 6.0.26 [1], > > > > ServerSocketChannel server = > > (ServerSocketChannel) key.channel(); > > SocketChannel channel = server.accept(); > > 266 -> channel.socket().setReceiveBufferSize(getRxBufSize()); > > > > so it is likely that ServerSocketChannel.accept() call on line 265 > > returned null. > > > > What is your Java vendor and version? > > > > [1] http://svn.apache.org/viewvc/tomcat/tc6.0.x/tags/TOMCAT_6_0_26/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java?revision=920929&view=markup#l266 > > > > > > > > By the way, when you will post your server.xml next time, please > > remove all the comments. > > > > > > Best regards, > > Konstantin Kolinko > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > > For additional commands, e-mail: users-help@tomcat.apache.org > > > > --=-MbsunmAKv7WusJ3YUTCl--