Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in retry.py #50

Closed
frankstratton opened this issue Jan 13, 2013 · 6 comments
Closed

error in retry.py #50

frankstratton opened this issue Jan 13, 2013 · 6 comments

Comments

@frankstratton
Copy link

Seeing this error after running for a while.

Looks like the sleep_func doesn't have a self param?

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/epanastasi/.virtualenvs/pyroxy/lib/python2.7/site-packages/kazoo/protocol/connection.py", line 406, in writer
    retry.increment()
  File "/Users/epanastasi/.virtualenvs/pyroxy/lib/python2.7/site-packages/kazoo/retry.py", line 64, in increment
    self.sleep_func(self._cur_delay + jitter)
TypeError: sleep() takes at most 1 argument (2 given)
@bbangert
Copy link
Member

Which version of kazoo?

@frankstratton
Copy link
Author

happens in 0.9

@helielson
Copy link

I also got it!!

kazoo==0.9

@labisso
Copy link
Contributor

labisso commented Mar 18, 2013

I ran into this issue myself and it turned out to be because I was accidentally using SequentialThreadingHandler (the default handler) in a gevent 0.13.x monkey-patched environment. Interestingly, everything else seems to work since the threading handler monkey-patches fine.

This change in SequentialThreadingHandler fixes the issue:

@@ -179,7 +179,7 @@ class SequentialThreadingHandler(object):
     """
     name = "sequential_threading_handler"
     timeout_exception = TimeoutError
-    sleep_func = time.sleep
+    sleep_func = staticmethod(time.sleep)

However I think we should not go down this road and instead force gevent users to use the gevent handler. If people disagree, I can commit my patch and test.

@bbangert
Copy link
Member

This only happens when using threading handler in gevent monkey-patching?

@labisso
Copy link
Contributor

labisso commented Mar 18, 2013

That's how I encountered it but I don't know if it is the only possibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants