Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ddtrace/internal/periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ def stop(self):
def run(self):
"""Run the target function periodically."""
while not self.quit.wait(self.interval):
# DEV: Some frameworks, like e.g. gevent, seem to resuscitate some
# of the threads that were running prior to the fork of the worker
# processes. These threads are normally created via the native API
# and are exposed to the child process as _DummyThreads. We check
# whether the current thread is no longer an instance of the
# original thread class to prevent it from running in the child
# process while the state copied over from the parent is being
# cleaned up. The restarting of the thread is responsibility to the
# registered forksafe hooks.
if not isinstance(threading.current_thread(), self.__class__):
break
self._target()
if self._on_shutdown is not None:
self._on_shutdown()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed an issue with gevent worker processes that caused them to crash and
stop.