kazoo icon indicating copy to clipboard operation
kazoo copied to clipboard

stuck when create ephemeral node in CONNECTED state event

Open endlesscode opened this issue 9 years ago • 5 comments

Hi ,guys, here is my code

        def watch_state(state):
            """
            Listen zookeeper connection events
            """
            if state == KazooState.LOST:
                self.logger.warn('connection to zookeeper lost, session expired')
            elif state == KazooState.SUSPENDED:
                self.logger.warn('connection to zookeeper suspended')
            elif state == KazooState.CONNECTED:
                self.logger.warn('connection to zookeeper restored')
                // stuck when call create node
                self._create_node()

It's no problem when I use this code in curator, but it is stuck in kazoo, where should I recreate the ephemeral node when kazoo reconnect to zookeeper after session expired ?

endlesscode avatar Sep 01 '15 02:09 endlesscode

Hello Endlesscode, I'm facing exact same issue with my code; when I turn off all the ZK observer nodes, kazoo goes from SUSPENDED > LOST state and when I bring ZK back, kazoo goes to CONNECTED and tries to publish the ephemeral node but doesn't get any response from ZK. Have you found a solution or a workaround? The only workaround that works for me is service restart which seems to resolve the issue. Thanks for your help!

amazhar avatar Jan 22 '16 10:01 amazhar

I run create_node in another thread :)

endlesscode avatar Apr 13 '16 13:04 endlesscode

@Endlesscode ,Is their any better way to solve the problem? Thanks

xlvecle avatar Apr 18 '16 04:04 xlvecle

I'm facing the same problem too ,does anyone has any better solution?

ZhenluShao avatar Sep 30 '16 08:09 ZhenluShao

I met similar problem when call any function of create_instance/get_children/get when state == KazooState.CONNECTED

it just stuck there and nothing error or return

zhjunqin avatar Jan 23 '19 13:01 zhjunqin