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
1 change: 1 addition & 0 deletions ddtrace/internal/nogevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def is_module_patched(module):
thread_get_ident = get_original(six.moves._thread.__name__, "get_ident")
Thread = get_original("threading", "Thread")
Lock = get_original("threading", "Lock")
RLock = get_original("threading", "RLock")

is_threading_patched = is_module_patched("threading")

Expand Down
4 changes: 3 additions & 1 deletion ddtrace/profiling/_threading.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class _ThreadLink(_thread_link_base):
# Key is a thread_id
# Value is a weakref to an object
_thread_id_to_object = attr.ib(factory=dict, repr=False, init=False, type=typing.Dict[int, _weakref_type])
_lock = attr.ib(factory=nogevent.Lock, repr=False, init=False, type=nogevent.Lock)
# Note that this lock has to be reentrant as spans can be activated unexpectedly in the same thread
# ex. during a gc weakref finalize callback
_lock = attr.ib(factory=nogevent.RLock, repr=False, init=False, type=nogevent.RLock)

def link_object(
self,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
profiling: fix a possible deadlock due to spans being activated unexpectedly.