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 <s.su...@protesa.it>:
> > >
> > > 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-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> > 

Reply via email to