[ https://issues.apache.org/jira/browse/ZOOKEEPER-1683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627495#comment-13627495 ]
Shevek commented on ZOOKEEPER-1683: ----------------------------------- sockKey == null, because previously: 2013-04-10 05:19:52,787 WARN [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxn$SendThread.run (ClientCnxn.java:1122 ) - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.6.0_24] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:592) ~[?:1.6.0_24] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:353) ~[zookeeper-3.5.0.jar:3.5.0--1] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1101) [zookeeper-3.5.0.jar:3.5.0--1] 2013-04-10 05:19:52,788 DEBUG [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxnSocketNIO.cleanup (ClientCnxnSocketNI O.java:193) - Ignoring exception during shutdown input java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:656) ~[?:1.6.0_24] at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:378) ~[?:1.6.0_24] at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:190) [zookeeper-3.5.0.jar:3.5.0--1] at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1190) [zookeeper-3.5.0.jar:3.5.0--1] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130) [zookeeper-3.5.0.jar:3.5.0--1] 2013-04-10 05:19:52,789 DEBUG [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxnSocketNIO.cleanup (ClientCnxnSocketNI O.java:200) - Ignoring exception during shutdown output java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:667) ~[?:1.6.0_24] at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:386) ~[?:1.6.0_24] at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:197) [zookeeper-3.5.0.jar:3.5.0--1] at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1190) [zookeeper-3.5.0.jar:3.5.0--1] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130) [zookeeper-3.5.0.jar:3.5.0--1] thus clearing sockKey. > ZooKeeper client NPE when updating server list on disconnected client > --------------------------------------------------------------------- > > Key: ZOOKEEPER-1683 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1683 > Project: ZooKeeper > Issue Type: Bug > Components: java client > Affects Versions: 3.5.0 > Reporter: Shevek > Assignee: Alexander Shraer > Fix For: 3.5.0 > > Attachments: ZOOKEEPER-1683.patch, ZOOKEEPER-1683-ver1.patch > > > 2013-04-04 22:16:15,872 ERROR [pool-4-thread-1] > com.netflix.curator.ConnectionState.getZooKeeper (ConnectionState.java:84) - > Background exception caught > java.lang.NullPointerException > at > org.apache.zookeeper.client.StaticHostProvider.updateServerList(StaticHostProvider.java:161) > ~[zookeeper-3.5.0.jar:3.5.0--1] > at > org.apache.zookeeper.ZooKeeper.updateServerList(ZooKeeper.java:183) > ~[zookeeper-3.5.0.jar:3.5.0--1] > at > com.netflix.curator.HandleHolder$1$1.setConnectionString(HandleHolder.java:121) > ~[curator-client-1.3.5-SNAPSHOT.jar:?] > The duff code is this: > ClientCnxnSocket clientCnxnSocket = cnxn.sendThread.getClientCnxnSocket(); > InetSocketAddress currentHost = (InetSocketAddress) > clientCnxnSocket.getRemoteSocketAddress(); > boolean reconfigMode = hostProvider.updateServerList(serverAddresses, > currentHost); > Now, currentHost might be null, if we're not yet connected. But > StaticHostProvider.updateServerList indirects on it unconditionally. > This would be caught by findbugs. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira