Repository navigation
Keep the Jetty 9 request URL when its query can't be read (quick fix) - #13359
Conversation
Jetty 9's HttpURI.getQuery() builds the query as
new String(_raw, _query + 1, _fragment - _query - 1, charset). For some
malformed request URIs the parsed offsets are inconsistent and it throws
StringIndexOutOfBoundsException. The exception escaped
RequestURIDataAdapter.innerRawQuery, so URL tagging failed ("Error
tagging url") and the span lost http.url altogether.
Treat an unreadable query as absent, so the scheme, host, port and path
are still tagged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df550b6fb7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
The gradle.lockfile for jetty-server-9.0 must be regenerated after adding the Mockito bundle, as it currently omits mockito-junit-jupiter and incompletely records mockito-core, violating the repository's dependency-change requirements in CONTRIBUTING.md.
🤖 Bits Code Review · Commit df550b6
🟢 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. |
Adding libs.bundles.mockito puts mockito-core on the test compile classpath and adds mockito-junit-jupiter; record both in the module's lockfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
More details
The PR preserves Jetty 9 URL tags when query extraction throws StringIndexOutOfBoundsException and adds mocked regression coverage. The latest commit records both Mockito dependencies on the test classpaths, resolving the earlier lockfile finding; no findings remain open, with validation limited to static review.
🤖 Bits Code Review · Commit 4bc1958
AlexeyKuznetsov-DD
left a comment
There was a problem hiding this comment.
LGTM. One small request for the PR description. The base code already sets http.url before reading the query. The behavior this PR changes is what happens next. Treating the unreadable query as absent lets request decoration continue after the query read fails. Could you update the description to reflect that?
|
/merge |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
The expected merge time in
|
What Does This Do
Keeps
http.urlon Jetty 9 server spans when Jetty itself can't produce the request's query string.jetty9.RequestURIDataAdapter.innerRawQuerycatches theStringIndexOutOfBoundsExceptionthatRequest.getQueryString()can throw, and treats the query as absent. The scheme, host, port and path are still read and tagged.RequestURIDataAdapterTestuses a mocked JettyRequest. It checks that a readable query passes through, and that an unreadable one yields anullraw and decoded query while the rest of the URL is still read. The module didn't have Mockito, so the PR addslibs.bundles.mockitoas a test dependency.Motivation
Instrumentation telemetry (Error Tracking issue
5edd9a7e-c73b-11f1-b9e2-da7ad0900002, first seen in 1.64.0, JDK 8):Line 41 is
return request.getQueryString();, so the exception comes from Jetty. In Jetty 9.0 (checked in the 9.0.0.v20130308 jar),HttpURI.getQuery()isnew String(_raw, _query + 1, _fragment - _query - 1, charset). When the parser leaves those offsets inconsistent for a malformed request URI, the constructor throws. The tracer can't fix Jetty, but the failure shouldn't cost the whole URL tag.Without the fix, the new test fails with
StringIndexOutOfBoundsException: String index out of range: -1. With it, the new tests pass, as do the module'stest(Jetty9InactiveAppSecTest) andforkedTestsuites (Jetty9V0/V1ForkedTestandJettyContinuationHandlerV0/V1ForkedTest, 302 tests).Additional Notes
getQueryString()throwing rather than parsing a real bad request.StringIndexOutOfBoundsExceptionis caught, the one observed. Other failures still propagate as before.🤖 Generated with Claude Code