You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Arpit Jain <ja...@gmail.com> on 2020/02/25 18:27:27 UTC

Curator state change listener

Hi,

I have a Zookeeper node and 2 instances of my application using Curator
client connected to same Zookeeper node. When I am killing the Zookeeper
node, only one of the curator instance gets a LOST notification. Both
applications are able to detect that Zookeeper is down but below log
message in listener appears only on one of the application instance.
Below is the code where I I create and register listener

        final CuratorFramework curatorFramework =

            CuratorFrameworkFactory.newClient(coordinatorHosts,
coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);


        curatorFramework.getConnectionStateListenable()

            .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE
CHANGED TO : {}", newState));


Any ideas why this behaviour ?


Thanks

Re: Curator state change listener

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
This isn't enough information in your email to give an answer. Please provide a test case.

-Jordan

> On Feb 26, 2020, at 7:46 AM, Arpit Jain <ja...@gmail.com> wrote:
> 
> 1. I am definitely getting a LOST message on both applications because I am shutting down application based on LOST state. This works fine. The only problem I am seeing is the below listener does not gets called every time on either of the application
>   
>        curatorFramework.getConnectionStateListenable()
>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE CHANGED TO : {}", newState));
> 
> This does not harm us but just wanted to highlight.
> 
> 2. Also on the leader side of my application, I am seeing below message
>        [L: ERROR] [O: o.a.c.f.r.l.LeaderSelector] [I: ] [U: ] [S: ] [P: platform1] [T: Curator-LeaderSelector-0] The leader threw an exception
> 
> Thanks
> 
> 
> On Tue, Feb 25, 2020 at 7:43 PM Jordan Zimmerman <jordan@jordanzimmerman.com <ma...@jordanzimmerman.com>> wrote:
> I'd need a lot more information to understand why. I suggest you set up a test case so we can look at it.
> 
> -Jordan
> 
>> On Feb 25, 2020, at 2:42 PM, Arpit Jain <jain.arpit6@gmail.com <ma...@gmail.com>> wrote:
>> 
>> There is only 1 zookeeper instance. Both curator logs says SUSPENDED but only one of them gets LOST.
>> 
>> On Tue, Feb 25, 2020, 6:32 PM Jordan Zimmerman <jordan@jordanzimmerman.com <ma...@jordanzimmerman.com>> wrote:
>> There's really only 1 ZooKeeper instance? If so, it's not possible that Curator won't report SUSPENDED and then LOST. If you have more than 1 ZooKeeper instance, how do you know both clients are connecting to the same instance? Likely they're not.
>> 
>> -Jordan
>> 
>>> On Feb 25, 2020, at 1:27 PM, Arpit Jain <jain.arpit6@gmail.com <ma...@gmail.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> I have a Zookeeper node and 2 instances of my application using Curator client connected to same Zookeeper node. When I am killing the Zookeeper node, only one of the curator instance gets a LOST notification. Both applications are able to detect that Zookeeper is down but below log message in listener appears only on one of the application instance.
>>> Below is the code where I I create and register listener 
>>> 
>>>         final CuratorFramework curatorFramework =
>>>             CuratorFrameworkFactory.newClient(coordinatorHosts, coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);
>>> 
>>>         curatorFramework.getConnectionStateListenable()
>>>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE CHANGED TO : {}", newState));
>>> 
>>> Any ideas why this behaviour ?
>>> 
>>> Thanks
>> 
> 


Re: Curator state change listener

Posted by Arpit Jain <ja...@gmail.com>.
1. I am definitely getting a LOST message on both applications because I am
shutting down application based on LOST state. This works fine. The only
problem I am seeing is the below listener does not gets called every time
on either of the application



       curatorFramework.getConnectionStateListenable()

            .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE
CHANGED TO : {}", newState));


This does not harm us but just wanted to highlight.


2. Also on the leader side of my application, I am seeing below message

       [L: ERROR] [O: o.a.c.f.r.l.LeaderSelector] [I: ] [U: ] [S: ] [P:
platform1] [T: Curator-LeaderSelector-0] The leader threw an exception


Thanks



On Tue, Feb 25, 2020 at 7:43 PM Jordan Zimmerman <jo...@jordanzimmerman.com>
wrote:

> I'd need a lot more information to understand why. I suggest you set up a
> test case so we can look at it.
>
> -Jordan
>
> On Feb 25, 2020, at 2:42 PM, Arpit Jain <ja...@gmail.com> wrote:
>
> There is only 1 zookeeper instance. Both curator logs says SUSPENDED but
> only one of them gets LOST.
>
> On Tue, Feb 25, 2020, 6:32 PM Jordan Zimmerman <jo...@jordanzimmerman.com>
> wrote:
>
>> There's really only 1 ZooKeeper instance? If so, it's not possible that
>> Curator won't report SUSPENDED and then LOST. If you have more than 1
>> ZooKeeper instance, how do you know both clients are connecting to the same
>> instance? Likely they're not.
>>
>> -Jordan
>>
>> On Feb 25, 2020, at 1:27 PM, Arpit Jain <ja...@gmail.com> wrote:
>>
>> Hi,
>>
>> I have a Zookeeper node and 2 instances of my application using Curator
>> client connected to same Zookeeper node. When I am killing the Zookeeper
>> node, only one of the curator instance gets a LOST notification. Both
>> applications are able to detect that Zookeeper is down but below log
>> message in listener appears only on one of the application instance.
>> Below is the code where I I create and register listener
>>
>>         final CuratorFramework curatorFramework =
>>             CuratorFrameworkFactory.newClient(coordinatorHosts,
>> coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);
>>
>>         curatorFramework.getConnectionStateListenable()
>>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER
>> STATE CHANGED TO : {}", newState));
>>
>> Any ideas why this behaviour ?
>>
>> Thanks
>>
>>
>>
>

Re: Curator state change listener

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
I'd need a lot more information to understand why. I suggest you set up a test case so we can look at it.

-Jordan

> On Feb 25, 2020, at 2:42 PM, Arpit Jain <ja...@gmail.com> wrote:
> 
> There is only 1 zookeeper instance. Both curator logs says SUSPENDED but only one of them gets LOST.
> 
> On Tue, Feb 25, 2020, 6:32 PM Jordan Zimmerman <jordan@jordanzimmerman.com <ma...@jordanzimmerman.com>> wrote:
> There's really only 1 ZooKeeper instance? If so, it's not possible that Curator won't report SUSPENDED and then LOST. If you have more than 1 ZooKeeper instance, how do you know both clients are connecting to the same instance? Likely they're not.
> 
> -Jordan
> 
>> On Feb 25, 2020, at 1:27 PM, Arpit Jain <jain.arpit6@gmail.com <ma...@gmail.com>> wrote:
>> 
>> Hi,
>> 
>> I have a Zookeeper node and 2 instances of my application using Curator client connected to same Zookeeper node. When I am killing the Zookeeper node, only one of the curator instance gets a LOST notification. Both applications are able to detect that Zookeeper is down but below log message in listener appears only on one of the application instance.
>> Below is the code where I I create and register listener 
>> 
>>         final CuratorFramework curatorFramework =
>>             CuratorFrameworkFactory.newClient(coordinatorHosts, coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);
>> 
>>         curatorFramework.getConnectionStateListenable()
>>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE CHANGED TO : {}", newState));
>> 
>> Any ideas why this behaviour ?
>> 
>> Thanks
> 


Re: Curator state change listener

Posted by Arpit Jain <ja...@gmail.com>.
There is only 1 zookeeper instance. Both curator logs says SUSPENDED but
only one of them gets LOST.

On Tue, Feb 25, 2020, 6:32 PM Jordan Zimmerman <jo...@jordanzimmerman.com>
wrote:

> There's really only 1 ZooKeeper instance? If so, it's not possible that
> Curator won't report SUSPENDED and then LOST. If you have more than 1
> ZooKeeper instance, how do you know both clients are connecting to the same
> instance? Likely they're not.
>
> -Jordan
>
> On Feb 25, 2020, at 1:27 PM, Arpit Jain <ja...@gmail.com> wrote:
>
> Hi,
>
> I have a Zookeeper node and 2 instances of my application using Curator
> client connected to same Zookeeper node. When I am killing the Zookeeper
> node, only one of the curator instance gets a LOST notification. Both
> applications are able to detect that Zookeeper is down but below log
> message in listener appears only on one of the application instance.
> Below is the code where I I create and register listener
>
>         final CuratorFramework curatorFramework =
>             CuratorFrameworkFactory.newClient(coordinatorHosts,
> coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);
>
>         curatorFramework.getConnectionStateListenable()
>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER
> STATE CHANGED TO : {}", newState));
>
> Any ideas why this behaviour ?
>
> Thanks
>
>
>

Re: Curator state change listener

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
There's really only 1 ZooKeeper instance? If so, it's not possible that Curator won't report SUSPENDED and then LOST. If you have more than 1 ZooKeeper instance, how do you know both clients are connecting to the same instance? Likely they're not.

-Jordan

> On Feb 25, 2020, at 1:27 PM, Arpit Jain <ja...@gmail.com> wrote:
> 
> Hi,
> 
> I have a Zookeeper node and 2 instances of my application using Curator client connected to same Zookeeper node. When I am killing the Zookeeper node, only one of the curator instance gets a LOST notification. Both applications are able to detect that Zookeeper is down but below log message in listener appears only on one of the application instance.
> Below is the code where I I create and register listener 
> 
>         final CuratorFramework curatorFramework =
>             CuratorFrameworkFactory.newClient(coordinatorHosts, coordinatorSessionTimeout, coordinatorConnectionTimeout, retryPolicy);
> 
>         curatorFramework.getConnectionStateListenable()
>             .addListener((client, newState) -> LOGGER.warn("ZOOKEEPER STATE CHANGED TO : {}", newState));
> 
> Any ideas why this behaviour ?
> 
> Thanks