Skip to content

contrib/golang: address race condition in Go HTTP filter#44429

Merged
botengyao merged 3 commits intoenvoyproxy:mainfrom
DataDog:henry.wang/go-filter-crash-upstream
Apr 16, 2026
Merged

contrib/golang: address race condition in Go HTTP filter#44429
botengyao merged 3 commits intoenvoyproxy:mainfrom
DataDog:henry.wang/go-filter-crash-upstream

Conversation

@henrymwang
Copy link
Copy Markdown
Contributor

@henrymwang henrymwang commented Apr 13, 2026

Commit Message:

addresses #44320

the issue here arises when the client sends data and the data is pending to be dispatched. Previously, the stream could have been destroyed already by the time continueStatusInternal was invoked. This PR adds safety-checks in the Go shim, and on the C++ filter side to avoid it

Additional Description: n/a
Risk Level: n/a
Testing:

this was tested by building Envoy + a test client that sends HTTP/1.1 + POST with a body, and verifying the crash happens before consistently, and no longer crashes with the patch

also added a test to confirm the behavior - the test fails on main but passes with the patch

Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

addresses envoyproxy#44320

the issue here arises when the client sends data and the data is pending
to be dispatched. Previously, the stream could have been destroyed
already by the time `continueStatusInternal` was invoked. This PR adds
safety-checks in the Go shim, and on the C++ filter side to avoid it

this was tested by building Envoy + a test client that sends HTTP/1.1 +
POST with a body, and verifying the crash happens before consistently,
and no longer crashes with the patch

Signed-off-by: Henry Wang <henry.wang@datadoghq.com>
Signed-off-by: Henry Wang <henry.wang@datadoghq.com>
Copy link
Copy Markdown
Contributor

@wdauchy wdauchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks correct. A few minor nits inline.

Comment thread contrib/golang/filters/http/source/go/pkg/http/shim.go
Comment thread contrib/golang/filters/http/test/golang_filter_test.cc
Signed-off-by: Henry Wang <henry.wang@datadoghq.com>
@botengyao botengyao merged commit b234fcc into envoyproxy:main Apr 16, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants