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

Watchdog doesn't work along with eventlet #332

Closed
gnuton opened this issue Aug 18, 2015 · 8 comments · Fixed by #589
Closed

Watchdog doesn't work along with eventlet #332

gnuton opened this issue Aug 18, 2015 · 8 comments · Fixed by #589

Comments

@gnuton
Copy link

gnuton commented Aug 18, 2015

Hi!
Observer cannot be instantiated in case eventlet.monkey_patch() patches Thread.

Here is the code which shows the problem:

# !/usr/bin/env python

from watchdog.observers import Observer
import eventlet
eventlet.monkey_patch()
obs = Observer() # THIS FAILS because of monkey_patch patches threads

Here is the exception I get running the above code

/usr/bin/python2.7 /home/gnuton/GIT/flickrsmartsync/flickrsmartsync/flickrsmartsync/test.py
Traceback (most recent call last):
  File "/home/gnuton/GIT/flickrsmartsync/flickrsmartsync/flickrsmartsync/test.py", line 6, in <module>
    obs = Observer() # THIS FAILS because of monkey_patch patches threads
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/inotify.py", line 186, in **init**
    timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 208, in **init**
    EventDispatcher.**init**(self, timeout)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 164, in **init**
    self._event_queue = EventQueue()
  File "/usr/lib/python2.7/Queue.py", line 28, in __init__
    self._init(maxsize)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/utils/bricks.py", line 87, in _init
    queue.Queue._init(self, maxsize)
TypeError: unbound method _init() must be called with Queue instance as first argument (got EventQueue instance instead)
@gnuton
Copy link
Author

gnuton commented Aug 19, 2015

Just out of curiosity this morning I tried to get watchdog observer working along with gevent lib instead of eventlet.
GEvent monkey patching thread doesn't make any trouble to the Observer constructor, but eventually the observer doesn't work as it should.. it looked to me it was not able to detect any change.

@tacy
Copy link

tacy commented Jan 19, 2016

+1

I want to call a method with eventlet in Myhandler. I just fix it use multiprocess

@samypr100
Copy link

+1

1 similar comment
@e0ne
Copy link

e0ne commented May 31, 2016

+1

openstack-gerrit pushed a commit to openstack/oslo.reports that referenced this issue Jun 15, 2016
In case if application is under Apache+mod_wsgi it is not recommended to
use signals [1]. We need to have configuration option for handling
'touch file' event instead of signal.

Alternative solutions:
1) watchdog: can monitor only directories, has issues with eventlet [2].
2) inotify: works only with linux-based systems.

[1]
https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIRestrictSignal

[2] gorakhargosh/watchdog#332

Change-Id: I6ef02457f21da8e6fbd50e57bfa503b3c31ddd76
Implements: blueprint guru-meditation-report-file-touch
@tohyongcheng
Copy link

+1

2 similar comments
@coffeegist
Copy link

+1

@cicada-lewis
Copy link

+1

BoboTiG added a commit that referenced this issue Nov 1, 2019
Introduced the @cpython_only marker for tests. Fixes #332.
@BoboTiG
Copy link
Collaborator

BoboTiG commented Nov 1, 2019

Fixed in master :)

CCP-Aporia pushed a commit to CCP-Aporia/watchdog that referenced this issue Aug 13, 2020
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

Successfully merging a pull request may close this issue.

8 participants