Repository navigation
Conversation
…ases `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Signed-off-by: Ryan Northey <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the request-body ordering change.
No open issues 🎉
What changed in this PR
This PR reduces flakiness in the Wasm filter integration tests by delaying request-body transmission until the upstream stream is established, avoiding the shared-buffer timing issue described in #48660.
Changes:
- Send body chunks after the upstream connection and request stream are available.
- Add a comment explaining the buffering assertion this ordering avoids.
| File | Description |
|---|---|
| test/extensions/filters/http/wasm/wasm_filter_integration_test.cc | Reorders request-body transmission and documents the timing dependency. |
Review effort: Balanced
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
) `wasm_filter_integration_test` sent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see envoyproxy#48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failed `ASSERT(parent_.state_.latest_data_decoding_filter_ == this)` on the next chunk. Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives. Backport note: picked from the pull request ahead of its merge to main. Signed-off-by: Ryan Northey <[email protected]>
|
This makes me uncomfortable because the description sounds like a race that could potentially go that way in production too, so having the test just avoid the race, when the race causes undesirable behavior, seems like it might be papering over a real issue. If it is a thing that can only happen because we're faking it in a test, then (given it's an integration test) the integration test framework should be fixed so it doesn't do something that won't happen in production, rather than just having this one test not do it. |
|
Agreed, it looks like the real race rather than a test artefact: the shared per-stream buffer that #48660 replaces with per-filter buffers. Running the same deflake ( |
|
Against #48660 (merge f4e3eef into main 8ce942c): 2000 runs of |
wasm_filter_integration_testsent the request body straight after the headers. Until the upstream connection is ready the upstream codec filter holds the headers, and when it resumes it is given whatever body an earlier filter has buffered so far (the buffer is shared by the filter chain, see #48660). When that happened between two chunks of the body, the upstream wasm filter that was buffering it no longer owned the buffered data and failedASSERT(parent_.state_.latest_data_decoding_filter_ == this)on the next chunk.Send the body once the request headers have reached the upstream, so that the codec filter is not waiting on the connection while the body arrives.
Seen in postsubmit CI on main (
cto.noadmin,BodyBufferedMultipleChunksManipulation/upstream_v8_cpp_http1, aborted on the assert).Testing:
*BodyBufferedMultipleChunksManipulation/upstream*with--config=compile-time-options -c fastbuild --define admin_functionality=disabledon RBE, 2000 runs each:All of the failures on main were the assert, with both HTTP/1 and HTTP/2 upstreams.
Risk Level: low (test only)