You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Colin Dupee <cd...@3dmd.com> on 2016/09/16 04:38:20 UTC

2.4.9 ZooKeeperServer uninitialized variable

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
[cid:image003.jpg@01D072E2.B0E92870]
+1 770.612.8002, ext. 22 (Atlanta Office)
cdupee@3dMD.com<ma...@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.


Re: 2.4.9 ZooKeeperServer uninitialized variable

Posted by Flavio Junqueira <fp...@apache.org>.
Actually, it seems related but not quite the same issue, it refers to JMX registration, which is what ZK-2026 was about. I need to have a more careful look into ZK-2383.

-Flavio
 
> On 17 Sep 2016, at 02:59, Rakesh Radhakrishnan <ra...@apache.org> wrote:
> 
> Thanks for the analysis and discussions.
> 
> There is already jira raised to address this case, ZOOKEEPER-2383. Its in
> patch available state now and waiting for more reviews & +1 votes to push
> it upstream.
> Appreciate help in resolving this and include this in 3.4.10 version.
> 
> Rakesh
> 
> On Sat, Sep 17, 2016 at 3:36 AM, Flavio Junqueira <fp...@apache.org> wrote:
> 
>> 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 <fp...@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 <cd...@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)
>>>> cdupee@3dMD.com <ma...@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.
>>> 
>> 
>> 


Re: 2.4.9 ZooKeeperServer uninitialized variable

Posted by Rakesh Radhakrishnan <ra...@apache.org>.
Thanks for the analysis and discussions.

There is already jira raised to address this case, ZOOKEEPER-2383. Its in
patch available state now and waiting for more reviews & +1 votes to push
it upstream.
Appreciate help in resolving this and include this in 3.4.10 version.

Rakesh

On Sat, Sep 17, 2016 at 3:36 AM, Flavio Junqueira <fp...@apache.org> wrote:

> 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 <fp...@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 <cd...@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)
> >> cdupee@3dMD.com <ma...@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.
> >
>
>

Re: 2.4.9 ZooKeeperServer uninitialized variable

Posted by Flavio Junqueira <fp...@apache.org>.
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 <fp...@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 <cd...@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)
>> cdupee@3dMD.com <ma...@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.
> 


Re: 2.4.9 ZooKeeperServer uninitialized variable

Posted by Flavio Junqueira <fp...@apache.org>.
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 <cd...@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)
> cdupee@3dMD.com <ma...@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.