Repository navigation
Conversation
|
I apologize, but I do not have the capability to trigger a retest of the pull request. As an AI assistant, I can only provide code reviews and summaries. To trigger a retest, please check your CI/CD platform's documentation or use the specific command provided by your repository's CI system. |
|
/retest |
|
@yanjunxiang-google PTAL as well when you have time. |
|
I think that this change should be self-contained within the ext_proc filter. FilterManager has already been quite polluted with ext_proc-specific code, and I don't want to propagate that behavior. |
|
I agree with @paul-r-gall that we should decouple from filter manager if possible. /wait |
|
Looking at the logs, the data is correctly processed by the ext_proc filter, then shipped to the router filter. If router filter successfully sends the data to the backend, why the retry mechanism is triggered? Should it clear the buffered data after it ships data upstream, thus the retry will not happen at all? |
let me try to refactor code to self-contained within the ext_proc filter. |
the retry buffer is kept alive through the entire response. only when the full response is received and the stream ends does the buffer get destroyed. the duplication happens during normal successful processing. e.g. when ext_proc trailer response arrives , the doData() still been called via continueDecoding(), this replays buffered_request_data_ back through the filter chain as if new data arrived. |
Thanks for working on this! emm, could you please give a more detail root cause analysis, with code pointers, about with the route retries enabled, why the issue happens with ext_proc, and why it does not happen without ext_proc? |
…roc body mode with retries enabled. Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue+I775165 <[email protected]> Signed-off-by: hai.yue <[email protected]>
9f0dbef to
7d1e17a
Compare
|
/wait |
Signed-off-by: hai.yue <[email protected]>
|
/assign @stevenzzzz |
|
Sorry, I've been on vacation for a while. Really this is a case of "filter manager buffering is completely broken when filters do really complicated stop/continue/buffer actions". I keep meaning to get around to a FilterManager-level fix here, and it just hasn't been able to get onto my list of things to do. Is it reasonable/possible to protect this behind a feature flag? e.g. |
I think a runtime feature flag can gate whether the router uses its own private retry buffer or the shared filter-chain buffer. maybe defaulting to the original filter-chain behavior for safety. |
…_retry_buffer to control whether the router uses its own private retry buffer or the shared filter-chain buffer Signed-off-by: hai.yue <[email protected]>
Signed-off-by: Hai <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
…y_buffer for failed test cases Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
Signed-off-by: hai.yue <[email protected]>
| "envoy.reloadable_features.router_use_private_retry_buffer") && | ||
| retry_buffer_ && retry_buffer_->length() > 0) { | ||
| Buffer::OwnedImpl copy(*retry_buffer_); | ||
| callbacks_->addDecodedData(copy, false); |
There was a problem hiding this comment.
could you please explain why here is false, and above is true?
There was a problem hiding this comment.
+1, since there's no buffered request data, I suspect that it doesn't matter, but confirmation from author of code would be great.
There was a problem hiding this comment.
I think 'true' means the data is arriving as a stream, it need to be accumulated. in decodeData() func, the downstream is still sending, more chunks may follow.
and the 'false' mean it is the final buffer, it is time to inject the entire accumulated body back into buffer. in setupRedirect() func, the full body already in retry_buffer_.
please let me know if I mis-understand the logic.
1. remove incorrect runtime guard envoy_reloadable_features_report_load_when_rq_active_is_non_zero 2. account streams in retry buffer 3. reset retry buffer when buffer overflow 4. rollback private retry buffer in old test cases add release note Signed-off-by: hai.yue <[email protected]>
Signed-off-by: Hai <[email protected]>
Signed-off-by: hai.yue <[email protected]>
|
@paul-r-gall and @yanjunxiang-google , good day. I've adjusted the code accordingly. could you please take another look at the PR when you get a chance? thanks for advise. |
|
PTAL when you have time @paul-r-gall @yanjunxiang-google |
|
@wbpcode @botengyao @yanavlasov |
|
Seems another problem because the across-filters shared data buffer + And i think retry isn't the only buggy scenario. For any filter after extproc, if the filter stop chain and buffer data, then the continue decoding/conitnueEnconding will replay the data in the shared buffer which is unexpected. I guess the per-filter-buffer would be the final solution. And I drafted one recently, and it's much simpler than i initially thought. #48556 is a first pre-PR of per-filter-buffer support. And it also addressed other related issue of extproc and I will share the left part tomorrow morning, after i get up. /wait |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Commit Message:
when the ExtProc HTTP filter is configured with requestBodyProcessingMode: FULL_DUPLEX_STREAMED and the router has retries enabled, the upstream receives the request body twice. once from the normal ext_proc forwarding path, and once replayed from the router's retry buffer.
Additional Description:
the flag skip_body_on_next_continue_ is added to ActiveStreamDecoderFilter. when set, bufferedData() returns a null pointer which causing doData() to be skipped. the router's retry buffer buffered_request_data_ is never modified, so retry correctness is preserved.
Risk Level:
Low
Testing:
Release Notes:
fix request body duplicated at upstream when using FULL_DUPLEX_STREAMED ext_proc body mode with retries enabled
Fixes #45470