-
Notifications
You must be signed in to change notification settings - Fork 429
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
fix: add timeout handling for subprocess wait #12806
fix: add timeout handling for subprocess wait #12806
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12806 +/- ##
==========================================
- Coverage 3.67% 3.67% -0.01%
==========================================
Files 1378 1378
Lines 135899 135899
==========================================
- Hits 4992 4990 -2
- Misses 130907 130909 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bootstrap import analysisComparison of import times between this PR and main. SummaryThe average import time in this PR is: 234 ± 4 ms. The average import time in main is: 234 ± 3 ms. The import time difference between this PR and main is: -0.0 ± 0.2 ms. The difference is not statistically significant (z = -0.22). Import time breakdownThe following import paths have shrunk:
|
BenchmarksBenchmark execution time: 2025-03-26 14:32:25 Comparing candidate commit af150ac in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 498 metrics, 2 unstable metrics. |
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.
Pull Request Overview
This PR introduces timeout handling for subprocess waits to ensure that any spawned subprocesses are terminated when a timeout is exceeded and to avoid zombie processes. Key changes include renaming the internal telemetry sending function to _send_telemetry, adding a try/finally block to properly close subprocess streams, and implementing a timeout check using p.wait(1) for Python versions 3.3 and above.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
One small comment about older Pythons Timeout.
Since its a small subset of places where we run - and this should also be handled by some of the injector guardrails.
I'll mark this PR as approved. But it would still be good to fix this timeout.
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
After subprocess is opened, wait and kill if Timeout is exceeded to ensure zombie processes are killed. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) https://datadoghq.atlassian.net/browse/APMLP-313 --------- Co-authored-by: brettlangdon <brett.langdon@datadoghq.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit b518cfd)
After subprocess is opened, wait and kill if Timeout is exceeded to ensure zombie processes are killed. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) https://datadoghq.atlassian.net/browse/APMLP-313 --------- Co-authored-by: brettlangdon <brett.langdon@datadoghq.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit b518cfd)
After subprocess is opened, wait and kill if Timeout is exceeded to ensure zombie processes are killed.
Checklist
Reviewer Checklist
https://datadoghq.atlassian.net/browse/APMLP-313