Title: Body duplication when using the ExtProc filter and enabling retry policy
Description:
Envoy version: 1.35.6
When using the ExtProc filter with requestBodyProcessingMode=FULL_DUPLEX_STREAMED, the request body is duplicated when retries are enabled.
ExtProc server request processing flow:
- Receive RequestHeaders request
- Receive RequestBody requests
- Receive RequestTrailers request
- Send RequestHeaders response (with mutation)
- Send RequestBody responses (chunks unchanged)
- Send RequestTrailers response (trailers unchanged)
The logs show that the http.router terminal filter receives the body two times:
... [ext_proc] Received request headers response
... [ext_proc] applying headers response. body mode = FULL_DUPLEX_STREAMED
... [ext_proc] Applying header mutations
... [ext_proc] Finish external processing call
... [ext_proc] Received request body response
... [ext_proc] Processing body response
... [ext_proc] FULL_DUPLEX_STREAMED body response is received and body_mode_: FULL_DUPLEX_STREAMED
... [ext_proc] Injecting 24 bytes of data to filter stream in FULL_DUPLEX_STREAMED mode. end_of_stream is false
... [router] router decoding headers: ...
... [router] router decoding data: 24
... [ext_proc] Finish external processing call
... [ext_proc] Received request trailers response
... [ext_proc] Applying response to buffered trailers, body_mode_ FULL_DUPLEX_STREAMED
... [ext_proc] Finish external processing call
... [ext_proc] Continue processing
... [router] router decoding data: 24
... [router] router decoding trailers: ...
The logs show the following:
- ExtProc receives chunks and forwards them to the upstream http.router filter.
- The router sends the data and buffers it, as retries are enabled.
- ExtProc receives the trailers and calls continueDecoding.
- ContinueDecoding calls decodeData, passing the buffer containing the request body as data.
- The router sends the data from the buffer that has already been sent.
A similar problem was described in #36119.
I am using a newer version but the problem still exists.
Title: Body duplication when using the ExtProc filter and enabling retry policy
Description:
Envoy version: 1.35.6
When using the ExtProc filter with requestBodyProcessingMode=FULL_DUPLEX_STREAMED, the request body is duplicated when retries are enabled.
ExtProc server request processing flow:
The logs show that the http.router terminal filter receives the body two times:
... [ext_proc] Received request headers response
... [ext_proc] applying headers response. body mode = FULL_DUPLEX_STREAMED
... [ext_proc] Applying header mutations
... [ext_proc] Finish external processing call
... [ext_proc] Received request body response
... [ext_proc] Processing body response
... [ext_proc] FULL_DUPLEX_STREAMED body response is received and body_mode_: FULL_DUPLEX_STREAMED
... [ext_proc] Injecting 24 bytes of data to filter stream in FULL_DUPLEX_STREAMED mode. end_of_stream is false
... [router] router decoding headers: ...
... [router] router decoding data: 24
... [ext_proc] Finish external processing call
... [ext_proc] Received request trailers response
... [ext_proc] Applying response to buffered trailers, body_mode_ FULL_DUPLEX_STREAMED
... [ext_proc] Finish external processing call
... [ext_proc] Continue processing
... [router] router decoding data: 24
... [router] router decoding trailers: ...
The logs show the following:
A similar problem was described in #36119.
I am using a newer version but the problem still exists.