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.
🟢 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. |
|
Hey @amarziali not sure if this is part of a group of PRs to solve this kind of issues but I found that apache-httpclient-5.0 has the identical span/scope leak on |
Good catch. Actually the diagnostics is plugged for trial on #12609 but can only audit things covered by a smoke tests. So yes it deserves a followup PR and a smoke tests so |
| DECORATE.afterStart(span); | ||
| DECORATE.onRequest(span, request); | ||
| } catch (BlockingException e) { | ||
| try { |
There was a problem hiding this comment.
❔ question: Should we have try / catch block here?
The only exception allowed is now a BlockingException since decorator methods are no longer allowed to raised anything else.
What Does This Do
AppSec blocking could leave an HTTP client span unfinished and its scope active in:
sendandsendAsync)These instrumentations create and activate a client span before calling
DECORATE.onRequest(). If AppSec throwsBlockingException, entry advice aborts before handing the scope to exit advice. For async requests, no completion callback has been registered either.Consequently, nobody finishes the client span or closes its scope. The unfinished client span cannot be reported as completed, and the lingering active context interferes with enclosing Spring and servlet scope cleanup. This does not necessarily prevent other finished spans in the trace from being published.
This PR cleans up the span and scope in the blocking path before rethrowing the exception, preserving call-depth reset and blocking behavior.
Motivation
Instrumentation tests did not exercise the blocking callback path. Existing AppSec smoke tests checked the blocking response and security event, which could succeed despite incomplete tracing cleanup.
Enabling scope diagnostics in smoke tests exposed the missing cleanup.
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]