tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rossbach ...@objektpark.de>
Subject Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc
Date Mon, 30 Oct 2006 16:12:54 GMT
Hi Filip,

I have use newest tomcat 6 svn head, with jdk 1.5.0_06, MAC OS X  
10.4.8, PPC,
fresh build.

Used Safari and FireFox 1.5

Open a Window 1

http://localhost:8080/examples/jsp/chat/login.jsp
-> get post.jsp dialog

Open new Window 2 with
http://localhost:8080/examples/jsp/chat/chat

-> send a message at window 1

result: see nothing at window 2
after 20 Sec (connectiontimeout from connector)
the messages flush at window 2

without my patch I git before a NPE at catalina.out.

Regards
Peter


Am 30.10.2006 um 16:52 schrieb Filip Hanik - Dev Lists:

> how do you reproduce this? I've added in your fix, but cant  
> reproduce the problem
>
> Filip
>
> Peter Rossbach wrote:
>> Hi Filip.
>>
>> you see at my situation the key can be null:
>>
>> 30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
>> INFO:  
>> socket=org.apache.tomcat.util.net.NioChannel@58473e:java.nio.channels 
>> .SocketChannel[connected local=/127.0.0.1:8080 remote=/ 
>> 127.0.0.1:50517] key=sun.nio.ch.SelectionKeyImpl@5138a4
>> 30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
>> INFO:  
>> socket=org.apache.tomcat.util.net.NioChannel@a6343d:java.nio.channels 
>> .SocketChannel[closed] key=null
>>                                                                       
>>                                                                       
>>                                                    #################
>>
>> Exception in thread "http-8080-2" java.lang.NullPointerException
>>         at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
>> (NioEndpoint.java:1442)
>>         at java.lang.Thread.run(Thread.java:613)
>>
>>
>> Here my patch:
>>
>> === L 1436 f
>>
>>                         NioChannel socket = (NioChannel)channel;
>>
>>                         SelectionKey key = socket.getIOChannel 
>> ().keyFor(socket.getPoller().getSelector());
>>                         int handshake = -1;
>>                         log.info("socket=" + socket + " key=" +  
>> key );
>>                         if(key != null) {
>>                             try {
>>                                 handshake = socket.handshake 
>> (key.isReadable(), key.isWritable());
>>                             }catch ( IOException x ) {
>>                                 handshake = -1;
>>                                 if ( log.isDebugEnabled() )  
>> log.debug("Error during SSL handshake",x);
>>                             }catch ( CancelledKeyException ckx ) {
>>                                 handshake = -1;
>>                             }
>>                         } else {
>>                                handshake = -1;
>>                         }
>>
>>                         if ( handshake == 0 ) {
>>                             // Process the request from this socket
>>                             if ((status != null) && (handler.event 
>> (socket, status) == Handler.SocketState.CLOSED)) {
>>                                 // Close socket and pool
>>                                 try {
>>                                     KeyAttachment att =  
>> (KeyAttachment)socket.getAttachment(true);
>>                                     try {socket.close();}catch  
>> (Exception ignore){}
>>                                     if ( socket.isOpen() )  
>> socket.close(true);
>>                                     nioChannels.offer(socket);
>>                                     if ( att!=null ) keyCache.offer 
>> (att);
>>                                 }catch ( Exception x ) {
>>                                     log.error("",x);
>>                                 }
>>                             } else if ((status == null) &&  
>> (handler.process(socket) == Handler.SocketState.CLOSED)) {
>>                                 // Close socket and pool
>>                                 try {
>>                                     KeyAttachment att =  
>> (KeyAttachment)socket.getAttachment(true);
>>                                     try {socket.close();}catch  
>> (Exception ignore){}
>>                                     if ( socket.isOpen() )  
>> socket.close(true);
>>                                     nioChannels.offer(socket);
>>                                     if ( att!=null ) keyCache.offer 
>> (att);
>>                                 }catch ( Exception x ) {
>>                                     log.error("",x);
>>                                 }
>>                             }
>>                         } else if (handshake == -1 ) {
>>                             if ( key != null && key.isValid() )  
>> key.cancel();
>>                             try {socket.close(true);}catch  
>> (IOException ignore){}
>>                             nioChannels.offer(socket);
>>                         } else {
>>                             final SelectionKey fk = key;
>>                             final int intops = handshake;
>>                             final KeyAttachment ka =  
>> (KeyAttachment)fk.attachment();
>>                             ka.getPoller().add(socket,intops);
>>                         }
>>                     }
>>                 } finally {
>>                     //dereference socket to let GC do its job
>>                     socket = null;
>>                     // Finish up this request
>>                     recycleWorkerThread(this);
>>                 }
>>             }
>>         }
>>
>> ====
>>
>> But why the chat messages don't responce only as socket close?
>>
>>     <Connector port="8080"
>>                maxThreads="150" connectionTimeout="20000"
>>                redirectPort="8443"
>>                protocol="org.apache.coyote.http11.Http11NioProtocol"
>>                />
>>
>> I only see comet begin event?
>> ==
>> 30.10.2006 16:19:28 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: attributeAdded 
>> ('org.apache.jasper.runtime.JspApplicationC
>> ontextImpl',  
>> 'org.apache.jasper.runtime.JspApplicationContextImpl@428ffa')
>> 30.10.2006 16:19:32 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: attributeReplaced 
>> ('C3E6394AC176D22B752C75D55343AA02', 'ni
>> ckname', 'pero')
>> 30.10.2006 16:19:35 org.apache.catalina.core.ApplicationContext log
>> INFO: ChatServlet: Begin for session:  
>> C3E6394AC176D22B752C75D55343AA02
>> 30.10.2006 16:25:17 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: contextDestroyed()
>> 30.10.2006 16:25:17 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: contextDestroyed()
>> 30.10.2006 16:25:22 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: contextInitialized()
>> 30.10.2006 16:25:22 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: contextInitialized()
>> 30.10.2006 16:25:33 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: attributeAdded 
>> ('org.apache.jasper.runtime.JspApplicationC
>> ontextImpl',  
>> 'org.apache.jasper.runtime.JspApplicationContextImpl@428ffa')
>> 30.10.2006 16:25:36 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: attributeReplaced 
>> ('C3E6394AC176D22B752C75D55343AA02', 'ni
>> ckname', 'pero')
>> 30.10.2006 16:25:40 org.apache.catalina.core.ApplicationContext log
>> INFO: ChatServlet: Begin for session:  
>> C3E6394AC176D22B752C75D55343AA02
>>
>> ===
>>
>> Regards
>> Peter
>>
>>
>>
>> Am 30.10.2006 um 15:53 schrieb Peter Rossbach:
>>
>>> Hi Filip,
>>>
>>> I found that MAC OS X only support setTrafficClass with following  
>>> JDK option
>>>
>>> -Djava.net.preferIPv4Stack=true
>>>
>>> http://lists.apple.com/archives/java-dev/2006/Jun/msg00414.html
>>>
>>> It seems a older IPV6 bug. At which place we can document those  
>>> things? -> F&Q
>>>
>>>
>>> The chat example flush the messages only I got NPE:
>>>
>>> INFO: Server startup in 2642 ms
>>> Exception in thread "http-8080-1" java.lang.NullPointerException
>>>         at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
>>> (NioEndpoint.java:1441)
>>>         at java.lang.Thread.run(Thread.java:613)
>>>
>>> After this NPE the messages flush to the browser an connection  
>>> are closed.
>>>
>>> Regards
>>> Peter
>>>
>>>
>>> Am 30.10.2006 um 15:04 schrieb Filip Hanik - Dev Lists:
>>>
>>>> try to set the property socket.soTrafficClass to some other value,
>>>> if it's not working, what JDK are you running, here is the flag  
>>>> described by SUN
>>>>
>>>> http://java.sun.com/j2se/1.5.0/docs/api/java/net/ 
>>>> Socket.html#setTrafficClass(int)
>>>>
>>>>
>>>>
>>>> Peter Rossbach wrote:
>>>>> Hi Filip,
>>>>>
>>>>> I am starting testing your new NioProtocol handler, but I got  
>>>>> following exception:
>>>>>
>>>>> 30.10.2006 13:37:24 org.apache.tomcat.util.net.NioEndpoint  
>>>>> setSocketOptions
>>>>> SCHWERWIEGEND:
>>>>> java.net.SocketException: Invalid argument
>>>>>         at sun.nio.ch.Net.setIntOption0(Native Method)
>>>>>         at sun.nio.ch.Net.setIntOption(Net.java:152)
>>>>>         at sun.nio.ch.SocketChannelImpl$1.setInt 
>>>>> (SocketChannelImpl.java:372)
>>>>>         at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java: 
>>>>> 46)
>>>>>         at sun.nio.ch.SocketOptsImpl$IP.typeOfService 
>>>>> (SocketOptsImpl.java:249)
>>>>>         at sun.nio.ch.OptionAdaptor.setTrafficClass 
>>>>> (OptionAdaptor.java:158)
>>>>>         at sun.nio.ch.SocketAdaptor.setTrafficClass 
>>>>> (SocketAdaptor.java:320)
>>>>>         at  
>>>>> org.apache.tomcat.util.net.SocketProperties.setProperties 
>>>>> (SocketProperties.java:107)
>>>>>         at  
>>>>> org.apache.tomcat.util.net.NioEndpoint.setSocketOptions 
>>>>> (NioEndpoint.java:742)
>>>>>         at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
>>>>> (NioEndpoint.java:1423)
>>>>>         at java.lang.Thread.run(Thread.java:613)
>>>>>
>>>>>
>>>>> ==
>>>>>
>>>>> My connector config is:
>>>>>
>>>>>     <Connector port="8080"
>>>>>                maxThreads="150" connectionTimeout="20000"
>>>>>                redirectPort="8443"
>>>>>                 
>>>>> protocol="org.apache.coyote.http11.Http11NioProtocol" />
>>>>>
>>>>> After some google search I found that soTrafficClass are not  
>>>>> supported at mac os x :-(
>>>>> s. http://jira.safehaus.org/browse/PENROSE-71
>>>>>
>>>>> I comment out  L 106 at class o.a.t.util.net.SocketProperties.
>>>>>
>>>>> //        socket.setTrafficClass(soTrafficClass);
>>>>>
>>>>> Before I did this: I check starting connector with some  
>>>>> different values without success
>>>>>
>>>>> ex.
>>>>>     <Connector port="8080"
>>>>>                maxThreads="150" connectionTimeout="20000"
>>>>>                redirectPort="8443"
>>>>>                 
>>>>> protocol="org.apache.coyote.http11.Http11NioProtocol"
>>>>>         socket.soTrafficClass="2" />
>>>>>
>>>>> After that patch the Connector work, but with the comet style  
>>>>> chat example I have more trouble:
>>>>>
>>>>> INFO: Server startup in 3025 ms
>>>>> Exception in thread "http-8080-1" java.lang.NullPointerException
>>>>>         at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
>>>>> (NioEndpoint.java:1441)
>>>>>         at java.lang.Thread.run(Thread.java:613)
>>>>> Exception in thread "http-8080-2" java.lang.NullPointerException
>>>>>         at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
>>>>> (NioEndpoint.java:1441)
>>>>>         at java.lang.Thread.run(Thread.java:613)
>>>>>
>>>>> --Chat example really working? I see the posted messages only  
>>>>> after socket is closed (with Firefox 1.5)...
>>>>>
>>>>> Next I test the chat example with APR handler, again.
>>>>>
>>>>> Regards
>>>>> Peter Ro├čbach
>>>>> pr@objektpark.de
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> ------
>>>>>
>>>>> No virus found in this incoming message.
>>>>> Checked by AVG Free Edition.
>>>>> Version: 7.1.408 / Virus Database: 268.13.17/505 - Release  
>>>>> Date: 10/27/2006
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>>>
>>>>
>>>
>>
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date:  
>> 10/27/2006
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message