Skip to content

fix(futures): avoid re-running inherited atexit handlers in forked gevent test - #20350

Draft
quinna-h wants to merge 1 commit into
mainfrom
propagation-concurrent-futures-gevent-fix
Draft

quinna-h wants to merge 1 commit into
mainfrom
propagation-concurrent-futures-gevent-fix

Conversation

@quinna-h

Copy link
Copy Markdown
Contributor

test_concurrent_futures_with_gevent forks and then calls sys.exit(0) in the child, which re-runs atexit handlers inherited from the parent (notably pytest-cov's coverage save, which walks the entire ddtrace/ tree). Under load this doubled, redundant work can exceed the test's 5s timeout and cause an intermittent hang. Use os._exit(0) instead, which is the standard way to terminate a forked child without re-running parent cleanup.

Description

Testing

Risks

Additional Notes

…vent test

test_concurrent_futures_with_gevent forks and then calls sys.exit(0) in the
child, which re-runs atexit handlers inherited from the parent (notably
pytest-cov's coverage save, which walks the entire ddtrace/ tree). Under
load this doubled, redundant work can exceed the test's 5s timeout and
cause an intermittent hang. Use os._exit(0) instead, which is the standard
way to terminate a forked child without re-running parent cleanup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Sep 15, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

Changelog | Validate changelog

View more details · View in GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 92c3c82 | Docs | View more details | Give us feedback!

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 1 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

tests/contrib/futures/test_propagation.py                               @DataDog/python-guild @DataDog/apm-idm-python

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 218 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 218 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=133)
ddtrace.internal.opentelemetry.span -×-> ddtrace.trace  (product:opentelemetry -> product:tracing, score=131)
ddtrace.profiling.scheduler -×-> ddtrace.trace  (product:profiling -> product:tracing, score=131)
ddtrace.llmobs._integrations.mcp -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=131)
ddtrace.llmobs._integrations.claude_agent_sdk -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=131)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant