rgs1/zk_shell

summary command throws exception if object in root deleted

Closed this issue · 0 comments

I am seeing the following exception, which I think happens if an object is deleted from / after summary starts running

Traceback (most recent call last):
File "bin/zk-shell", line 22, in
CLI()()
File "./zk_shell/cli.py", line 145, in call
rc = 0 if shell.onecmd(params.run_once) == None else 1
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "./zk_shell/shell.py", line 99, in wrapper
return func(_args, *_kwargs)
File "./zk_shell/xcmd.py", line 186, in wrapper
return func(args[0], params)
File "./zk_shell/shell.py", line 148, in wrapper
return func(self, params)
File "./zk_shell/shell.py", line 921, in do_summary
time.ctime(stat.created).ljust(32),
AttributeError: 'NoneType' object has no attribute 'created'

To reproduce

  • Standalone zookeeper server with one client connected which continuously does on an node in / :
    create
    sleep
    delete
    sleep
  • a shell script to loop and invoke zkshell --run-once summary
    Exception happens pretty quickly for me, <20 seconds in most cases

It looks like if a node is deleted, StatMap.get() returns a tuple which can contain None for the ZnodeStat and the code in shell.py does not handle this