CXF-8096: Fix LoggingFeature blocking read on streaming responses#2957
Draft
CXF-8096: Fix LoggingFeature blocking read on streaming responses#2957
Conversation
WireTapIn was eagerly reading the entire input stream (via IOUtils.copyAtLeast) before the application could process it. For streaming responses (e.g. StreamingOutput), this blocked the client from reading data incrementally. The fix replaces the eager copy + SequenceInputStream approach with a TeeInputStream that copies data to the logging cache as it flows through, up to the configured limit. LoggingInInterceptor now defers logging to a close callback when the stream hasn't been consumed yet, allowing streaming responses to flow through without blocking. Supersedes #574. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The 5-second timeout introduced in #2962 is still not sufficient for CI environments under load. Tracing tests like testThatNewSpanIsCreatedOnClientTimeout continue to fail with ConditionTimeoutException at the 5-second mark. Increase all Awaitility timeouts to 10 seconds across all tracing test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CXF-8096 —
LoggingFeatureblocks client reads on streaming responses.Root cause:
WireTapIninterceptor eagerly reads the entire input stream viaIOUtils.copyAtLeast()before the application can process it. For streaming responses (e.g.,StreamingOutputwith chunked transfer), this blocks the client from reading data incrementally.Fix:
TeeInputStream— wraps the input stream and copies data to the logging cache as it flows through (up to the configured limit), without blockingWireTapInnow usesTeeInputStreaminstead of the eagercopyAtLeast+SequenceInputStreamapproachLoggingInInterceptordefers logging to a stream-close callback when the stream hasn't been consumed yet (streaming case), while preserving immediate logging for cases where the body is already consumed (e.g., SOAP/JAX-WS where unmarshal happens before PRE_INVOKE)Key files:
TeeInputStream.java— new class, copies reads toCachedOutputStreamtransparentlyWireTapIn.java— usesTeeInputStreaminstead of eager readLoggingInInterceptor.java— deferred logging via close callbackstreamingInputShouldNotBlockReadtest verifying the streaming scenarioSupersedes #574 (which was test-only with no fix).
Test plan
streamingInputShouldNotBlockRead) verifies non-blocking behavior🤖 Generated with Claude Code