envoy icon indicating copy to clipboard operation
envoy copied to clipboard

golang filter returns with unexpected response code when the payload exceeds its buffer limit size

Open ardikabs opened this issue 1 year ago • 3 comments

Title: golang filter returns with unexpected response code when the payload exceeds its buffer limit size

Description: In the EncodeData phase, if the response payload exceeds the buffer limit size, the GoLang filter currently responds with a 413 error (Payload Too Large). This can be misleading as it suggests an error related to the client's request, which ideally 4xx errors are associated with downstream issues.

Additional Information: Tested in v1.29.4, as the code is also present in the latest release, it remains applicable.

Related codes: https://github.com/envoyproxy/envoy/blob/3a1e104a140d523c6797bd2da53103ab0b1582a0/contrib/golang/filters/http/source/processor_state.cc#L363-L371

Slack discussion: https://envoyproxy.slack.com/archives/C04QNSXC7U0/p1715513921673679?thread_ts=1715440619.442059&cid=C04QNSXC7U0

cc @doujiang24

ardikabs avatar May 13 '24 15:05 ardikabs

Thanks @ardikabs it’s a bug. the response status should be 500, same as filter manager here: https://github.com/envoyproxy/envoy/blob/main/source/common/http/filter_manager.cc#L1782-L1784

doujiang24 avatar May 14 '24 00:05 doujiang24

@doujiang24 what's the intended state of this? Are you fixing it? Are you suggesting the reporter might fix it? Should it be "help wanted"?

ravenblackx avatar May 14 '24 15:05 ravenblackx

Thanks @ravenblackx , I'll fix it soon

doujiang24 avatar May 15 '24 00:05 doujiang24