You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Julien Vermillard (JIRA)" <ji...@apache.org> on 2005/05/27 09:25:52 UTC

[jira] Commented: (DIRMINA-47) NullPointerException in SocketIoProcessor

     [ http://issues.apache.org/jira/browse/DIRMINA-47?page=comments#action_66431 ]
     
Julien Vermillard commented on DIRMINA-47:
------------------------------------------

what are you exactly doing for closing and creating new ProtocolSession ?  The ProtocolSession with NULL selection keys is the newly opened one or the closed one ?

> NullPointerException in SocketIoProcessor
> -----------------------------------------
>
>          Key: DIRMINA-47
>          URL: http://issues.apache.org/jira/browse/DIRMINA-47
>      Project: Directory MINA
>         Type: Bug
>     Versions: 0.7.1
>     Reporter: Trustin Lee
>     Assignee: Trustin Lee
>      Fix For: 0.7.2

>
> Adam Hathcock wrote:
> java.lang.NullPointerException
>     at org.apache.mina.io.socket.SocketIoProcessor.flush(SocketIoProcessor.java:496)
>     at org.apache.mina.io.socket.SocketIoProcessor.flushSessions(SocketIoProcessor.java:402)
>     at org.apache.mina.io.socket.SocketIoProcessor.access$3(SocketIoProcessor.java:377)
>     at org.apache.mina.io.socket.SocketIoProcessor$Worker.run(SocketIoProcessor.java:525)
> is error I'm running into and I'm unsure of the cause.  I am closing ProtocolSessions and creating new ones which may have something to do with it.  I also use the DemuxingProtocolCodecFactory to manage my protocol messages as well as their encoding and decoding.  
> I cannot figure out how the session's SelectionKey is becoming null.  I am using a checkout of the 0.7 branch from earlier today.  
> This error occurs after I create a new connection and start using the ProtocolSession.  I'm still not sure what causes it but everything appears to still work if I put a try/catch for a NullPointerException in the SocketIoProcessor around line 496

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DIRMINA-47) NullPointerException in SocketIoProcessor

Posted by Adam Hathcock <ha...@auburn.edu>.
here is a little more detail:
closed 1 IAL-G5.local/10.0.0.107:1032 /10.0.0.107:52748
connect created 4 /10.0.0.107:10333 /10.0.0.107:52755
     org.apache.mina.protocol.io.IoProtocolSession@3e15f7
4
java.lang.NullPointerException
     at org.apache.mina.io.socket.SocketIoProcessor.flush 
(SocketIoProcessor.java:497)
     at org.apache.mina.io.socket.SocketIoProcessor.flushSessions 
(SocketIoProcessor.java:402)
     at org.apache.mina.io.socket.SocketIoProcessor.access$3 
(SocketIoProcessor.java:377)
     at org.apache.mina.io.socket.SocketIoProcessor$Worker.run 
(SocketIoProcessor.java:530)

I'm using local instances of the same program to test it.  The nodes  
can join and leave a Chord ring in a p2p style so that the network  
will stay alive while individual nodes are added or shutdown.  I am  
closing a connect with an attachment of a static Integer of 1, just  
to keep track of what it is.  I create a new connection with static  
Integer of 4 (just happens to be the 4th one I create).  The creation  
itself seems to trigger the error.  Usually after this connection is  
made, there is a wait period before it is used.

Sample code that hopefully makes sense out of context:

public void connectToPredecessor() throws IOException {
         if (this.predecessorSession != null) {
             this.predecessorSession.close();
             System.out.println("closed " +  
predecessorSession.getAttachment() + " " +  
predecessorSession.getRemoteAddress() + " " +  
predecessorSession.getLocalAddress());
         }
         this.predecessorSession = connect(this.getPredecessorAddress 
());
     }

public ProtocolSession connect(SocketAddress address) throws  
IOException {
         IoProtocolConnector connector = new IoProtocolConnector(new  
SocketConnector());
         ProtocolSession session = connector.connect(address, 60,  
getProvider());
         session.setAttachment(ChordUtil.getCount());
         System.out.println("connect created " + session.getAttachment 
() + " " + session.getRemoteAddress() + " " + session.getLocalAddress 
());
         return session;
     }

The connectToPredecessor method is only done if I'm sure a new  
address was set.  Like I said, I could be misusing MINA but its just  
odd that everything seems to work fine.  I'll try to make a test case  
soon.


On May 27, 2005, at 2:25 AM, Julien Vermillard (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/DIRMINA-47? 
> page=comments#action_66431 ]
>
> Julien Vermillard commented on DIRMINA-47:
> ------------------------------------------
>
> what are you exactly doing for closing and creating new  
> ProtocolSession ?  The ProtocolSession with NULL selection keys is  
> the newly opened one or the closed one ?
>
>
>> NullPointerException in SocketIoProcessor
>> -----------------------------------------
>>
>>          Key: DIRMINA-47
>>          URL: http://issues.apache.org/jira/browse/DIRMINA-47
>>      Project: Directory MINA
>>         Type: Bug
>>     Versions: 0.7.1
>>     Reporter: Trustin Lee
>>     Assignee: Trustin Lee
>>      Fix For: 0.7.2
>>
>
>
>>
>> Adam Hathcock wrote:
>> java.lang.NullPointerException
>>     at org.apache.mina.io.socket.SocketIoProcessor.flush 
>> (SocketIoProcessor.java:496)
>>     at org.apache.mina.io.socket.SocketIoProcessor.flushSessions 
>> (SocketIoProcessor.java:402)
>>     at org.apache.mina.io.socket.SocketIoProcessor.access$3 
>> (SocketIoProcessor.java:377)
>>     at org.apache.mina.io.socket.SocketIoProcessor$Worker.run 
>> (SocketIoProcessor.java:525)
>> is error I'm running into and I'm unsure of the cause.  I am  
>> closing ProtocolSessions and creating new ones which may have  
>> something to do with it.  I also use the  
>> DemuxingProtocolCodecFactory to manage my protocol messages as  
>> well as their encoding and decoding.
>> I cannot figure out how the session's SelectionKey is becoming  
>> null.  I am using a checkout of the 0.7 branch from earlier today.
>> This error occurs after I create a new connection and start using  
>> the ProtocolSession.  I'm still not sure what causes it but  
>> everything appears to still work if I put a try/catch for a  
>> NullPointerException in the SocketIoProcessor around line 496
>>
>
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the  
> administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
>
>