-
Notifications
You must be signed in to change notification settings - Fork 373
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
Allow profiler to run without "no signals" workaround on passenger 6.0.19+ #3280
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…0.19+ **What does this PR do?** This PR is the last step to fully fixing the issue reported in #2976. In that issue, we discovered that he passenger web server had an incompatibility with the profiler. At the time, we added code to detect when passenger was in use and apply the "no signals" workaround to avoid this issue out-of-the-box. Upstream passenger has since accepted our PR to fix the issue, allowing us in this PR to change our detection logic to: a) Not enable the "no signals" workaround on passenger 6.0.19+ b) Provide an actionable error message to customers on older passenger versions to tell them that the best option is to upgrade **Motivation:** Improve the out-of-the-box experience of profiler users that use the passenger web server. **Additional Notes:** N/A **How to test the change?** I used the following `config.ru`: ```ruby def self.fib(n) n <= 1 ? n : fib(n-1) + fib(n-2) end app = ->(env) { puts " ** Got request!" [200, {}, ["Hello, World! #{fib(30)}"]] } run app ``` and `Gemfile`: ```ruby source 'https://rubygems.org' gem 'ddtrace', path: 'path/to/local/repo' #gem 'passenger', '= 6.0.18' gem 'passenger', '= 6.0.19' gem 'puma' ``` to validate that the passenger versions are correctly detected + request processing is not impacted on either. Fixes #2976
ivoanjo
force-pushed
the
ivoanjo/passenger-detection-improvements
branch
from
November 24, 2023 12:27
82b7a83
to
80d5b61
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3280 +/- ##
==========================================
- Coverage 98.23% 98.22% -0.01%
==========================================
Files 1253 1253
Lines 72393 72409 +16
Branches 3393 3395 +2
==========================================
+ Hits 71112 71127 +15
- Misses 1281 1282 +1 ☔ View full report in Codecov by Sentry. |
AlexJF
approved these changes
Nov 24, 2023
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.
LGTM 👍
Merged
ivoanjo
added a commit
that referenced
this pull request
Jul 2, 2024
…ems.rb` **What does this PR do?** In #2978 because of an incompatibility with Phusion Passenger, we added autodetection code to enable the "no signals" workaround when this web server is in use. This code was later extended in #3280 once an upstream fix was released, so that the "no signals" workaround was only applied on old Passenger versions. But in #3721 we got a report that our version detection code did not work correctly in setups where Passenger was not installed via `Gemfile`/`gems.rb`. This PR fixes the version detection in these situations. **Motivation:** Make sure the "no signals" workaround does not get enabled in setups where it does not need to be. **Additional Notes:** N/A **How to test the change?** I've added test coverage for this issue. Additionally, here's how to manually install Passenger and validate that the "no signals" workaround does not get enabled: ``` $ cat Gemfile source 'https://rubygems.org' gem 'datadog', git: 'https://github.com/DataDog/dd-trace-rb.git', branch: 'ivoanjo/prof-10015-fix-passenger-detection' gem 'rack' $ cat config.ru require 'datadog/profiling/preload' app = ->(env) { puts "Running on passenger #{PhusionPassenger::VERSION_STRING.inspect}" [200, {}, ["Hello, World!"]] } run app $ docker run --network=host -ti -v `pwd`:/working ruby:3.3 /bin/bash $ cd working/ $ apt update && apt-get install -y dirmngr gnupg apt-transport-https ca-certificates curl $ curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg >/dev/null $ sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bookworm main > /etc/apt/sources.list.d/passenger.list' $ apt update && apt-get install -y nginx libnginx-mod-http-passenger $ bundle install $ DD_PROFILING_ENABLED=true /usr/bin/passenger start ``` in master this outputs the warning message > WARN -- datadog: [datadog] Enabling the profiling "no signals" > workaround because an incompatible version of the passenger gem > is installed. Profiling data will have lower quality.To fix this, > upgrade the passenger gem to version 6.0.19 or above. With this fix, this message is not shown, confirming the "no signals" workaround is not enabled.
ivoanjo
added a commit
that referenced
this pull request
Jul 2, 2024
…ems.rb` **What does this PR do?** In #2978 because of an incompatibility with Phusion Passenger, we added autodetection code to enable the "no signals" workaround when this web server is in use. This code was later extended in #3280 once an upstream fix was released, so that the "no signals" workaround was only applied on old Passenger versions. But in #3721 we got a report that our version detection code did not work correctly in setups where Passenger was not installed via `Gemfile`/`gems.rb`. This PR fixes the version detection in these situations. **Motivation:** Make sure the "no signals" workaround does not get enabled in setups where it does not need to be. **Additional Notes:** N/A **How to test the change?** I've added test coverage for this issue. Additionally, here's how to manually install Passenger and validate that the "no signals" workaround does not get enabled: ``` $ cat Gemfile source 'https://rubygems.org' gem 'datadog', git: 'https://github.com/DataDog/dd-trace-rb.git', branch: 'ivoanjo/prof-10015-fix-passenger-detection' gem 'rack' $ cat config.ru require 'datadog/profiling/preload' app = ->(env) { puts "Running on passenger #{PhusionPassenger::VERSION_STRING.inspect}" [200, {}, ["Hello, World!"]] } run app $ docker run --network=host -ti -v `pwd`:/working ruby:3.3 /bin/bash $ cd working/ $ apt update && apt-get install -y dirmngr gnupg apt-transport-https ca-certificates curl $ curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg >/dev/null $ sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bookworm main > /etc/apt/sources.list.d/passenger.list' $ apt update && apt-get install -y nginx libnginx-mod-http-passenger $ bundle install $ DD_PROFILING_ENABLED=true /usr/bin/passenger start ``` in master this outputs the warning message > WARN -- datadog: [datadog] Enabling the profiling "no signals" > workaround because an incompatible version of the passenger gem > is installed. Profiling data will have lower quality.To fix this, > upgrade the passenger gem to version 6.0.19 or above. With this fix, this message is not shown, confirming the "no signals" workaround is not enabled.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
This PR is the last step to fully fixing the issue reported in #2976.
In that issue, we discovered that he passenger web server had an incompatibility with the profiler. At the time, we added code to detect when passenger was in use and apply the "no signals" workaround to avoid this issue out-of-the-box.
Upstream passenger has since accepted our PR to fix the issue, allowing us in this PR to change our detection logic to:
a) Not enable the "no signals" workaround on passenger 6.0.19+
b) Provide an actionable error message to customers on older passenger versions to tell them that the best option is to upgrade
Motivation:
Improve the out-of-the-box experience of profiler users that use the passenger web server.
Additional Notes:
N/A
How to test the change?
I used the following
config.ru
:and
Gemfile
:to validate that the passenger versions are correctly detected + request processing is not impacted on either.
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.Fixes #2976