I've been able to repro this. There is a race in NIOServerCnxnFactory.startup. 
We start the cnxn factory before we call startup on the zookeeper server. If we 
call createSession from the cnxn factory before we start the server, then we 
get the NPE. An easy way to repro is to add a sleep here:

@Override
    public void startup(ZooKeeperServer zks) throws IOException,
            InterruptedException {
        start();
        setZooKeeperServer(zks);
        zks.startdata();
        Thread.sleep(3000);
        zks.startup();
    }

Afaict, this does't cause any problem on the server, and the client will simply 
try again. It is ugly, though, we should fix it for the next release.

I believe the issue that introduced it is ZOOKEEPER-2026.

-Flavio


> On 16 Sep 2016, at 20:02, Flavio Junqueira <f...@apache.org> wrote:
> 
> Thanks for reporting this issue. Could you create a jira for this, please?
> 
> Also, small observation, but I think you meant to say 3.4.9 in the subject.
> 
> -Flavio
> 
>> On 16 Sep 2016, at 05:38, Colin Dupee <cdu...@3dmd.com> wrote:
>> 
>> It appears sessionTracker was intended to have a value of null, but simply 
>> has no value assigned (@109).  This results in a failure to compare to null 
>> in startup (@415), and an object never being created.  While the server 
>> seems to be at least partially functional, it does produce an NPE on 
>> startup: 
>> 2016-09-16 00:12:31,285 [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] WARN  
>> org.apache.zookeeper.server.NIOServerCnxnFactory  - Ignoring unexpected 
>> runtime exception
>> java.lang.NullPointerException
>>                at 
>> org.apache.zookeeper.server.ZooKeeperServer.createSession(ZooKeeperServer.java:597)
>>                at 
>> org.apache.zookeeper.server.ZooKeeperServer.processConnectRequest(ZooKeeperServer.java:930)
>>                at 
>> org.apache.zookeeper.server.NIOServerCnxn.readConnectRequest(NIOServerCnxn.java:418)
>>                at 
>> org.apache.zookeeper.server.NIOServerCnxn.readPayload(NIOServerCnxn.java:198)
>>                at 
>> org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:244)
>>                at 
>> org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:203)
>>                at java.lang.Thread.run(Thread.java:745)
>> 
>> Colin DUP√ČE
>> Computer Scientist
>> 3dMD LLC
>> 
>> +1 770.612.8002, ext. 22 (Atlanta Office)
>> cdu...@3dmd.com <mailto:cdu...@3dmd.com> 
>> 3dMD.com <http://www.3dmd.com/>
>> 
>> Follow 3dMD on: linkedin.com/company/3dmd 
>> <http://www.linkedin.com/company/3dmd>
>> Find 3dMD on: facebook.com/3dMDcommunity 
>> <https://www.facebook.com/3dMDcommunity>
>> Follow 3dMD on: twitter.com/3dMD <https://twitter.com/3dMD>
>> 
>> Confidentiality Notice: This e-mail transmission, including any attachments, 
>> contains confidential information and is protected by law as a legally 
>> privileged document and copyright work. Its content is for the sole use of 
>> the intended recipient(s) and should not be disclosed, given or copied to 
>> anyone other than the person(s) named or referenced above. Any unauthorized 
>> review, retransmission, dissemination, or other use of this information by 
>> other than the intended recipient is prohibited. If you are not the intended 
>> recipient and have received this email in error, please contact the sender 
>> by reply e-mail and destroy all copies of the original message.
> 

Reply via email to