Don't allow simultaneous memory and CPU profiling #3922
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See tikv/pprof-rs#36. Running the pprof CPU profiler at the same time as the jemalloc profiler is apparently UB. It reliably causes deadlocks in Materialize if the jemalloc sampling rate is aggressive enough (e.g. 2^14).
If another user accesses
/prof
while a CPU profile is running, this will have the unfortunate side effect of hanging their page load until the profile is done. We can improve that UX as a follow-up, but it requires a bit of refactoring (it's not as simple as just callingtry_lock
) and since it's a purely cosmetic issue, I didn't want it to block this UB safety issue.This change is