Prevent OkHttp connection pools from retaining request contexts - #12492
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The new matchers cover the specified OkHttp 2, 3, and 4 pool methods. The advice restores the earlier propagation state after each call.
🤖 Datadog Autotest · Commit c88a3a8 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
🎯 Code Coverage (details) 🔗 Commit SHA: c88a3a8 | Docs | View more details | Give us feedback! |
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Yes because the enforcement I will put in place with #12458 when all the issues are solved, will enforce that leakage check. Hence future library evolutions will cause the CI to hang if drifting |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 916f929: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
f9b4550
into
master
What Does This Do
Disables generic asynchronous context propagation while OkHttp adds connections to its internal connection pools.
This covers:
ConnectionPool.addConnectionandConnectionPool.putRealConnectionPool.putConnection pools schedule long-lived cleanup work. Propagating the current request context into that work can retain the request trace beyond its actual lifetime.
flowchart LR A[Request thread<br/>request context active] B[ConnectionPool.put] C[Long-lived cleanup task] D[Request completes] A --> B B -->|🔴 previous: propagate request context| C C -->|retain until cleanup runs| L[🔴 Delayed trace completion] B -->|🟢 propagation disabled| C A --> D D -->|close request scope| G[🟢 Trace completes normally]Motivation
The pool cleanup task belongs to the connection pool lifecycle, not to the request that happened to create or register the connection.
Blocking propagation at the pool boundary prevents the cleanup task from retaining an unrelated request context while preserving propagation for normal OkHttp request work.
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]