Closed albertyw closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
23ff43b
) 86.65% compared to head (6537b6e
) 86.67%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'd like to point out while this stop silk from interfering with processing a request, it also ends up not profiling that particular request. Prior to Python 3.11, the effect was similar but different (it would disable/stop the first profiler, and then start this current one). Neither outcome seems great, especially since this problem will happen when Django is processing multiple long-running requests at the same time (I've made a minimal repo here to highlight this issue)
I think at a minimum, the documentation should tell users that this issue exists. In terms of a proper fix, I'm not sure at the moment if that's possible without using another profiler that properly supports multithreaded applications (such as https://github.com/sumerc/yappi)
Thank you for pointing out this oversight, @robinchow. I'd take a look into yappi
Prior to Python 3.11, the effect was similar but different (it would disable/stop the first profiler, and then start this current one)
3.11 or 3.12? This code gives an error in python 3.12 but no error in 3.11:
import cProfile
p1 = cProfile.Profile()
p1.enable()
p2 = cProfile.Profile()
p2.enable()
@albertyw ah yes, apologies, prior to Python 3.12.
Fixes #682 Unblocks #686