You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Fournier, Camille F." <Ca...@gs.com> on 2011/08/12 20:00:06 UTC

what happens when AuthenticationProvider throws an exception

Hi guys,

So debugging some fun issues in my dev cluster, I discovered that due to some bad user data, my AuthenticationProvider was throwing a null pointer exception inside the handleAuthentication call. This call is made inside of NIOServerCnxn.readRequest, and there is no try catch block. So it bubbles all the way up to the NIOServerCnxn run method, which only logs it. Eventually I end up with the corrupted request buffer I sent earlier:
2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@347] - Failed to process sessionid:0x5319dd2bf3403f4 type:exists cxid:0x0 zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a
java.io.EOFException
        at java.io.DataInputStream.readFully(DataInputStream.java:180)
        at java.io.DataInputStream.readFully(DataInputStream.java:152)
        at org.apache.jute.BinaryInputArchive.readString(BinaryInputArchive.java:82)
        at org.apache.zookeeper.proto.ExistsRequest.deserialize(ExistsRequest.java:55)
        at org.apache.zookeeper.server.ZooKeeperServer.byteBuffer2Record(ZooKeeperServer.java:599)
        at org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:227)
        at org.apache.zookeeper.server.quorum.Leader$ToBeAppliedRequestProcessor.processRequest(Leader.java:540)
        at org.apache.zookeeper.server.quorum.CommitProcessor.run(CommitProcessor.java:73)
2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@354] - Dumping request buffer: 0x504150ffffffff

I suspect this is due to the fact that, in the readPayload method, we don't call clear on lenBuffer when an exception is thrown by readRequest.

Question:
Obviously, I need to fix the exception that is being thrown by my AuthenticationProvider, but do we want to put some try/catch logic around that call? It seems like the error there is probably contributing to my corrupted buffer problem.

C


RE: what happens when AuthenticationProvider throws an exception

Posted by "Fournier, Camille F." <Ca...@gs.com>.
Welcome back from vacation :) Yeah, I checked in a fix and Ben committed it to trunk last week so we're good to go.

C

-----Original Message-----
From: Patrick Hunt [mailto:phunt@apache.org] 
Sent: Thursday, August 25, 2011 3:16 PM
To: dev@zookeeper.apache.org
Subject: Re: what happens when AuthenticationProvider throws an exception

Probably should have caught up with all my email first... did you find
a resolution for this?

On Fri, Aug 12, 2011 at 11:00 AM, Fournier, Camille F.
<Ca...@gs.com> wrote:
> Hi guys,
>
> So debugging some fun issues in my dev cluster, I discovered that due to some bad user data, my AuthenticationProvider was throwing a null pointer exception inside the handleAuthentication call. This call is made inside of NIOServerCnxn.readRequest, and there is no try catch block. So it bubbles all the way up to the NIOServerCnxn run method, which only logs it. Eventually I end up with the corrupted request buffer I sent earlier:
> 2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@347] - Failed to process sessionid:0x5319dd2bf3403f4 type:exists cxid:0x0 zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a
> java.io.EOFException
>        at java.io.DataInputStream.readFully(DataInputStream.java:180)
>        at java.io.DataInputStream.readFully(DataInputStream.java:152)
>        at org.apache.jute.BinaryInputArchive.readString(BinaryInputArchive.java:82)
>        at org.apache.zookeeper.proto.ExistsRequest.deserialize(ExistsRequest.java:55)
>        at org.apache.zookeeper.server.ZooKeeperServer.byteBuffer2Record(ZooKeeperServer.java:599)
>        at org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:227)
>        at org.apache.zookeeper.server.quorum.Leader$ToBeAppliedRequestProcessor.processRequest(Leader.java:540)
>        at org.apache.zookeeper.server.quorum.CommitProcessor.run(CommitProcessor.java:73)
> 2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@354] - Dumping request buffer: 0x504150ffffffff
>
> I suspect this is due to the fact that, in the readPayload method, we don't call clear on lenBuffer when an exception is thrown by readRequest.
>
> Question:
> Obviously, I need to fix the exception that is being thrown by my AuthenticationProvider, but do we want to put some try/catch logic around that call? It seems like the error there is probably contributing to my corrupted buffer problem.
>
> C
>
>

Re: what happens when AuthenticationProvider throws an exception

Posted by Patrick Hunt <ph...@apache.org>.
Probably should have caught up with all my email first... did you find
a resolution for this?

On Fri, Aug 12, 2011 at 11:00 AM, Fournier, Camille F.
<Ca...@gs.com> wrote:
> Hi guys,
>
> So debugging some fun issues in my dev cluster, I discovered that due to some bad user data, my AuthenticationProvider was throwing a null pointer exception inside the handleAuthentication call. This call is made inside of NIOServerCnxn.readRequest, and there is no try catch block. So it bubbles all the way up to the NIOServerCnxn run method, which only logs it. Eventually I end up with the corrupted request buffer I sent earlier:
> 2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@347] - Failed to process sessionid:0x5319dd2bf3403f4 type:exists cxid:0x0 zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a
> java.io.EOFException
>        at java.io.DataInputStream.readFully(DataInputStream.java:180)
>        at java.io.DataInputStream.readFully(DataInputStream.java:152)
>        at org.apache.jute.BinaryInputArchive.readString(BinaryInputArchive.java:82)
>        at org.apache.zookeeper.proto.ExistsRequest.deserialize(ExistsRequest.java:55)
>        at org.apache.zookeeper.server.ZooKeeperServer.byteBuffer2Record(ZooKeeperServer.java:599)
>        at org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:227)
>        at org.apache.zookeeper.server.quorum.Leader$ToBeAppliedRequestProcessor.processRequest(Leader.java:540)
>        at org.apache.zookeeper.server.quorum.CommitProcessor.run(CommitProcessor.java:73)
> 2011-08-12 08:01:16,602 - ERROR [CommitProcessor:4:FinalRequestProcessor@354] - Dumping request buffer: 0x504150ffffffff
>
> I suspect this is due to the fact that, in the readPayload method, we don't call clear on lenBuffer when an exception is thrown by readRequest.
>
> Question:
> Obviously, I need to fix the exception that is being thrown by my AuthenticationProvider, but do we want to put some try/catch logic around that call? It seems like the error there is probably contributing to my corrupted buffer problem.
>
> C
>
>