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

Using RLock (instead of Lock) to prevent deadlocks when using sentry and ddtrace at the same time. #4159

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antonpirker
Copy link
Member

Refs #3753

@antonpirker antonpirker changed the title Using RLock to prevent deadlocks when using sentry and ddtrace at the same time. Using RLock (instead of Lock) to prevent deadlocks when using sentry and ddtrace at the same time. Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.57%. Comparing base (5dcda1d) to head (02380b7).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4159   +/-   ##
=======================================
  Coverage   79.57%   79.57%           
=======================================
  Files         141      141           
  Lines       15711    15711           
  Branches     2671     2671           
=======================================
  Hits        12502    12502           
  Misses       2367     2367           
  Partials      842      842           
Files with missing lines Coverage Δ
sentry_sdk/worker.py 80.41% <100.00%> (ø)

@sl0thentr0py
Copy link
Member

what is the actual problem and how does this fix it?

@antonpirker
Copy link
Member Author

This is an experiment.

The problem described in #3753 is roughly like this:

  • DataDog is monitoring lock operations
  • Sentry's worker thread needs to acquire a lock
  • When lock operations occur, DataDog tries to log information
  • Logging triggers Sentry's logging integration
  • Sentry tries to capture this event
  • Capturing an event requires Sentry's worker thread
  • The worker thread needs to acquire a lock...

By changing to RLock the given reproduction does not run into a deadlock anymore. But I am not 100% sure that this does not lead to other problems. (I think it does not, but I am not sure)

@antonpirker
Copy link
Member Author

I wanted to see if any of our test start failing if using RLock.

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 this pull request may close these issues.

2 participants