You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2008/05/28 14:31:45 UTC

[jira] Commented: (HADOOP-3453) ipc.Client.close() throws NullPointerException

    [ https://issues.apache.org/jira/browse/HADOOP-3453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600453#action_12600453 ] 

Steve Loughran commented on HADOOP-3453:
----------------------------------------

I can see the second of these.

The problem is that setupIOStreams tries to clean up 
  try {
       ...
       this.out = new DataOutputStream
            (new BufferedOutputStream(NetUtils.getOutputStream(socket)));
      ...
      } catch (IOException e) {
        markClosed(e);
        close();
      }

but what does close() do? It synchronizes on out, which will be null if the exception happened before the output stream was created, leading to our friend NPE:
    synchronized (out) {
        // release the resources
        // first thing to do;take the connection out of the connection list
        synchronized (connections) {
          if (connections.get(remoteId) == this) {
            connections.remove(remoteId);
          }
        }


> ipc.Client.close() throws NullPointerException
> ----------------------------------------------
>
>                 Key: HADOOP-3453
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3453
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: ipc
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Hairong Kuang
>
> There are two possible cases that Client.close() throws NullPointerException
> - Exception in thread "IPC Client (47) connection to localhost/127.0.0.1:3070 from tsz" java.lang.NullPointerException
>     at org.apache.hadoop.ipc.Client$Connection.close(Client.java:521)
>     at org.apache.hadoop.ipc.Client$Connection.run(Client.java:434)
> - Exception in thread "Thread-2" java.lang.NullPointerException
>     at org.apache.hadoop.ipc.Client$Connection.close(Client.java:519)
>     at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:317)
>     at org.apache.hadoop.ipc.Client$Connection.access$1700(Client.java:175)
>     at org.apache.hadoop.ipc.Client.getConnection(Client.java:766)
>     at org.apache.hadoop.ipc.Client.call(Client.java:680)
>     at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:216)
>     ...

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