-
Notifications
You must be signed in to change notification settings - Fork 375
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
[PROF-7409] Do not auto-enable new profiler when rugged gem is detected #2741
Conversation
This is useful when testing if a specific bit of code is affected by sigprof signal delivery. I'm using it to test the issue reported in #2721. I think this helper is small enough/useful enough to keep around for later.
**What does this PR do?**: This PR adds the `rugged` gem to the list of gems that prevent the new CPU Profiling 2.0 profiler from being auto-enabled. This is needed because the `rugged` gem (more specifically, its C-level dependencies) do not correctly handle the unix signals that the new profiler uses. We plan to do more than just add this workaround, but until we do so, this change will prevent customers from being bitten by the issue. **Motivation**: Make sure that customers being moved to the new CPU Profiling 2.0 profiler have a smooth experience. **Additional Notes**: N/A **How to test the change?**: The snippet shared by the customer in <#2721> reproduces the issue for me every time. With this change, as expected, the issue no longer appears.
@@ -222,6 +223,7 @@ void collectors_cpu_and_wall_time_worker_init(VALUE profiling_module) { | |||
rb_define_singleton_method(testing_module, "_native_simulate_handle_sampling_signal", _native_simulate_handle_sampling_signal, 0); | |||
rb_define_singleton_method(testing_module, "_native_simulate_sample_from_postponed_job", _native_simulate_sample_from_postponed_job, 0); | |||
rb_define_singleton_method(testing_module, "_native_is_sigprof_blocked_in_current_thread", _native_is_sigprof_blocked_in_current_thread, 0); | |||
rb_define_singleton_method(testing_module, "_native_with_blocked_sigprof", _native_with_blocked_sigprof, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this as a useful helper to test in issues like this (see individual commits for details)
if Gem.loaded_specs['rugged'] | ||
Datadog.logger.warn( | ||
'Falling back to legacy profiler because rugged gem is installed. Some operations on this gem are ' \ | ||
'currently incompatible with the new CPU Profiling 2.0 profiler, as detailed in ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a subset of the rugged gem that's safe, like an specific version? I'm asking so users know when it makes sense to try to enable profiling 2.0 anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, there isn't. It's on my next-things-to-do list to report this upstream and even seeing if I can submit a PR with a fix or workaround, which would allow us to indeed make this finer-grained than what this PR does.
What does this PR do?:
This PR adds the
rugged
gem to the list of gems that prevent the new CPU Profiling 2.0 profiler from being auto-enabled.This is needed because the
rugged
gem (more specifically, its C-level dependencies) do not correctly handle the unix signals that the new profiler uses.We plan to do more than just add this workaround, but until we do so, this change will prevent customers from being bitten by the issue.
Motivation:
Make sure that customers being moved to the new CPU Profiling 2.0 profiler have a smooth experience.
Additional Notes:
N/A
How to test the change?:
The snippet shared by the customer in #2721 reproduces the issue for me every time.
With this change, as expected, the issue no longer appears.