You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Nicholas Knight (JIRA)" <ji...@apache.org> on 2010/11/08 09:58:18 UTC

[jira] Updated: (ZOOKEEPER-921) zkPython interferes with/corrupts Python's 'logging' module

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicholas Knight updated ZOOKEEPER-921:
--------------------------------------

    Attachment: zktest.py

Script showing issue. This has been tested with a ZooKeeper 3.3.1 instance, with both the bindings in the 3.3.1 source tree, and those from an svn checkout of trunk (from within the last few hours). Results were identical with both bindings.

If '/SomeDir' exists, but '/SomeDir/last_modified' does not, this is the erroneous output from the script:

{noformat}
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@660: Client environment:zookeeper.version=zookeeper C client 3.4.0
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@664: Client environment:host.name=Nicholas-Knights-MacBook-Pro.local
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@671: Client environment:os.name=Darwin
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@672: Client environment:os.arch=10.4.0
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@673: Client environment:os.version=Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386
2010-11-08 16:53:04,916:2623(0x7fff71077c20):ZOO_INFO@log_env@681: Client environment:user.name=nknight
2010-11-08 16:53:04,917:2623(0x7fff71077c20):ZOO_INFO@log_env@689: Client environment:user.home=/Users/nknight
2010-11-08 16:53:04,917:2623(0x7fff71077c20):ZOO_INFO@log_env@701: Client environment:user.dir=/Users/nknight
2010-11-08 16:53:04,917:2623(0x7fff71077c20):ZOO_INFO@zookeeper_init@729: Initiating client connection, host=127.0.0.1:2181 sessionTimeout=10000 watcher=0x0 sessionId=0 sessionPasswd=<null> context=0x0 flags=0
2010-11-08 16:53:04,917:2623(0x100602000):ZOO_INFO@check_events@1587: initiated connection to server [127.0.0.1:2181]
2010-11-08 16:53:04,919:2623(0x100602000):ZOO_INFO@check_events@1634: session establishment complete on server [127.0.0.1:2181], sessionId=0x12c2a04fa7501ab, negotiated timeout=10000
Traceback (most recent call last):
  File "zktest.py", line 21, in <module>
    logger.debug("Boom?")
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1008, in debug
    if self.isEnabledFor(DEBUG):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1206, in isEnabledFor
    return level >= self.getEffectiveLevel()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1194, in getEffectiveLevel
    while logger:
TypeError: an integer is required
{noformat}

If the node already exists (as is the case if you run the script a second time), you get expected results:

{noformat}
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@660: Client environment:zookeeper.version=zookeeper C client 3.4.0
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@664: Client environment:host.name=Nicholas-Knights-MacBook-Pro.local
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@671: Client environment:os.name=Darwin
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@672: Client environment:os.arch=10.4.0
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@673: Client environment:os.version=Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386
2010-11-08 16:55:55,555:2630(0x7fff71077c20):ZOO_INFO@log_env@681: Client environment:user.name=nknight
2010-11-08 16:55:55,556:2630(0x7fff71077c20):ZOO_INFO@log_env@689: Client environment:user.home=/Users/nknight
2010-11-08 16:55:55,556:2630(0x7fff71077c20):ZOO_INFO@log_env@701: Client environment:user.dir=/Users/nknight
2010-11-08 16:55:55,556:2630(0x7fff71077c20):ZOO_INFO@zookeeper_init@729: Initiating client connection, host=127.0.0.1:2181 sessionTimeout=10000 watcher=0x0 sessionId=0 sessionPasswd=<null> context=0x0 flags=0
2010-11-08 16:55:55,557:2630(0x100602000):ZOO_INFO@check_events@1587: initiated connection to server [127.0.0.1:2181]
2010-11-08 16:55:55,558:2630(0x100602000):ZOO_INFO@check_events@1634: session establishment complete on server [127.0.0.1:2181], sessionId=0x12c2a04fa7501ac, negotiated timeout=10000
Caught exception: NodeExistsException('node exists',)
DEBUG:Boom:Boom?
{noformat}


If /SomeDir doesn't exist, you also get expected results:

{noformat}
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@660: Client environment:zookeeper.version=zookeeper C client 3.4.0
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@664: Client environment:host.name=Nicholas-Knights-MacBook-Pro.local
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@671: Client environment:os.name=Darwin
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@672: Client environment:os.arch=10.4.0
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@673: Client environment:os.version=Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386
2010-11-08 16:56:59,198:2634(0x7fff71077c20):ZOO_INFO@log_env@681: Client environment:user.name=nknight
2010-11-08 16:56:59,199:2634(0x7fff71077c20):ZOO_INFO@log_env@689: Client environment:user.home=/Users/nknight
2010-11-08 16:56:59,199:2634(0x7fff71077c20):ZOO_INFO@log_env@701: Client environment:user.dir=/Users/nknight
2010-11-08 16:56:59,199:2634(0x7fff71077c20):ZOO_INFO@zookeeper_init@729: Initiating client connection, host=127.0.0.1:2181 sessionTimeout=10000 watcher=0x0 sessionId=0 sessionPasswd=<null> context=0x0 flags=0
2010-11-08 16:56:59,200:2634(0x100602000):ZOO_INFO@check_events@1587: initiated connection to server [127.0.0.1:2181]
2010-11-08 16:56:59,202:2634(0x100602000):ZOO_INFO@check_events@1634: session establishment complete on server [127.0.0.1:2181], sessionId=0x12c2a04fa7501ad, negotiated timeout=10000
Caught exception: NoNodeException('no node',)
DEBUG:Boom:Boom?
{noformat}


> zkPython interferes with/corrupts Python's 'logging' module
> -----------------------------------------------------------
>
>                 Key: ZOOKEEPER-921
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-921
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.3.1, 3.4.0
>         Environment: Mac OS X 10.6.4, included Python 2.6.1
>            Reporter: Nicholas Knight
>         Attachments: zktest.py
>
>
> Calling {{zookeeper.create()}} seems, under certain circumstances, to be corrupting a subsequent call to Python's {{logging}} module.
> Specifically, if the node does not exist (but its parent does), I end up with a traceback like this when I try to make the logging call:
> {noformat}
> Traceback (most recent call last):
>   File "zktest.py", line 21, in <module>
>     logger.error("Boom?")
>   File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1046, in error
>     if self.isEnabledFor(ERROR):
>   File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1206, in isEnabledFor
>     return level >= self.getEffectiveLevel()
>   File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1194, in getEffectiveLevel
>     while logger:
> TypeError: an integer is required
> {noformat}
> But if the node already exists, or the parent does not exist, I get the appropriate NodeExists or NoNode exceptions.
> I'll be attaching a test script that can be used to reproduce this behavior.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.