-Re: why does ZK ignore null pointer errors?
Patrick Hunt 2012-12-19, 08:17
On Mon, Dec 17, 2012 at 5:44 AM, Brian Tarbox <[EMAIL PROTECTED]> wrote:
> I'm trying to track down an issue where my zk cluster rolls over and I've
> come across the main run loop in NIOServerCnxnFactory.java.
> I keep getting NullPointerError at line 190 which is:
> InetAddress ia = sc.socket().getInetAddress()
> but it is caught by a catch block at 217 that prints the message:
> "Ignoring unexpected runtime exception".
> I'm of the school of thought that discourages ingnoring NPE!
> Can anyone enlighten me what the reasoning behind this code is?
While the server socket is open we try our best to accept connections
regardless what happens on any one selector operation. Technically
we're not ignoring, we're logging it and continuing/ignoring.
I've only ever seen that line NPE in one case. It seemed to be related
to the client connecting and failing (closing?) while the acceptor was
in the process of accepting. Do you have any insight into what's
happening in this case?