You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "S. Nageswara Rao (JIRA)" <ji...@apache.org> on 2007/04/25 11:59:15 UTC

[jira] Created: (DIRMINA-373) NullPointer Exception in SocketAccept class

NullPointer Exception in SocketAccept class
-------------------------------------------

                 Key: DIRMINA-373
                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
             Project: MINA
          Issue Type: Bug
    Affects Versions: 0.8.0
         Environment: Windows XP
            Reporter: S. Nageswara Rao
             Fix For: 0.8.0


I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.

java.lang.NullPointerException
	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)

This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-373) NullPointer Exception in SocketAccept class

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRMINA-373.
-------------------------------------


> NullPointer Exception in SocketAccept class
> -------------------------------------------
>
>                 Key: DIRMINA-373
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows XP
>            Reporter: S. Nageswara Rao
>            Assignee: Trustin Lee
>             Fix For: 0.8.0
>
>
> I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.
> java.lang.NullPointerException
> 	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
> 	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
> 	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)
> This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-373) NullPointer Exception in SocketAccept class

Posted by "peter royal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493066 ] 

peter royal commented on DIRMINA-373:
-------------------------------------

You can check the history of the code for 1.0 at:

http://svn.apache.org/viewvc/mina/branches/1.0/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?view=log



> NullPointer Exception in SocketAccept class
> -------------------------------------------
>
>                 Key: DIRMINA-373
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows XP
>            Reporter: S. Nageswara Rao
>             Fix For: 0.8.0
>
>
> I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.
> java.lang.NullPointerException
> 	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
> 	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
> 	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)
> This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRMINA-373) NullPointer Exception in SocketAccept class

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee resolved DIRMINA-373.
---------------------------------

    Resolution: Cannot Reproduce
      Assignee: Trustin Lee

I compared the current SocketAcceptor code against that of 0.7.4 and couldn't find any noticeable difference, and I cannot reproduce the problem.  Please attach a reproducing JUnit test code.  I will mark this issue as 'cannot reproduce' for now.

> NullPointer Exception in SocketAccept class
> -------------------------------------------
>
>                 Key: DIRMINA-373
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows XP
>            Reporter: S. Nageswara Rao
>            Assignee: Trustin Lee
>             Fix For: 0.8.0
>
>
> I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.
> java.lang.NullPointerException
> 	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
> 	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
> 	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)
> This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-373) NullPointer Exception in SocketAccept class

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491586 ] 

Trustin Lee commented on DIRMINA-373:
-------------------------------------

We don't support MINA 0.8.x for now.  Please upgrade to 1.0.3 or 1.1.0.

> NullPointer Exception in SocketAccept class
> -------------------------------------------
>
>                 Key: DIRMINA-373
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows XP
>            Reporter: S. Nageswara Rao
>             Fix For: 0.8.0
>
>
> I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.
> java.lang.NullPointerException
> 	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
> 	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
> 	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)
> This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-373) NullPointer Exception in SocketAccept class

Posted by "S. Nageswara Rao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491603 ] 

S. Nageswara Rao commented on DIRMINA-373:
------------------------------------------

Hi Tustin,

Thanks for the quick response. I wish I would upgrade to 1.1.0 but there also we can expect the same NullPointerException from cancelKey method of SocketAcceptor class.

Code snippet of SocketAccptor class:

 private void cancelKeys()
    {
        if( cancelQueue.isEmpty() )
        {
            return;
        }

        for( ; ; )
        {
            CancellationRequest request = cancelQueue.poll();

            if( request == null )
            {
                break;
            }

            ServerSocketChannel ssc = channels.remove( request.address );

            // close the channel
            try
            {
                if( ssc == null )
                {
                    request.exception = new IllegalArgumentException( "Address not bound: " + request.address );
                }
                else
                {
                    SelectionKey key = ssc.keyFor( selector );
                    request.registrationRequest = ( RegistrationRequest ) key.attachment();
                    key.cancel();

                    selector.wakeup(); // wake up again to trigger thread death

                    ssc.close();
                }
            }
            catch( IOException e )
            {
                ExceptionMonitor.getInstance().exceptionCaught( e );
            }
            finally
            {
                request.done.countDown();

                if( request.exception == null )
                {
                    getListeners().fireServiceDeactivated(
                        this, request.address,
                        request.registrationRequest.handler,
                        request.registrationRequest.config );
                }
            }
        }
    }

If we can add the check for null value before calling cancel() on key, the problem gets solved.

if (key !=null)
  key.cancel()

I have tried it on 0.7.4 version and it solved the issue. Since our component is moved to maven project building system and we created a mina dependency, I would like to see the fix in the mina source that is exposed under directory-network artifact-Id of the maven repository


> NullPointer Exception in SocketAccept class
> -------------------------------------------
>
>                 Key: DIRMINA-373
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-373
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows XP
>            Reporter: S. Nageswara Rao
>             Fix For: 0.8.0
>
>
> I am using MINA v0.8.0 in my component. I hit upon the following NullPointer Exception when I try to call unbind method to unregister the service from the registry.
> java.lang.NullPointerException
> 	at org.apache.mina.io.socket.SocketAcceptor.cancelKeys(SocketAcceptor.java:431)
> 	at org.apache.mina.io.socket.SocketAcceptor.access$900(SocketAcceptor.java:47)
> 	at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:240)
> This has a considerable impact on my component.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.