Skip to content

Apply weak pointer semantics to streams in HTTP1 codec#44676

Open
reubent-goog wants to merge 4 commits intoenvoyproxy:mainfrom
reubent-goog:weak-ptr
Open

Apply weak pointer semantics to streams in HTTP1 codec#44676
reubent-goog wants to merge 4 commits intoenvoyproxy:mainfrom
reubent-goog:weak-ptr

Conversation

@reubent-goog
Copy link
Copy Markdown
Contributor

Commit Message: Apply weak pointer semantics to HTTP/1 streams in ServerConnectionImpl and ClientConnectionImpl
Additional Description:
This change applies an existing pattern used to fix use-after-free issues in h2/h3 to both ServerConnectionImpl and ClientConnectionImpl in the HTTP/1 codec to safely access decoders. We replaced raw pointers to RequestDecoder and ResponseDecoder with RequestDecoderHandlePtr and ResponseDecoderHandlePtr respectively. This allows safe verification of whether the decoder is still valid before attempting to access it. We have also added ENVOY_BUG assertions to catch instances where the decoder is unexpectedly null. After running all tests internally, expectedly, there are no existing instances of the ENVOY_BUGs. Tests have been added/updated for both paths to verify that the ENVOY_BUG is triggered as expected when decoders are destroyed before message completion.

Disclosure: Used Gen AI to help generate the code and tests
Risk Level: Low (safety improvement using established patterns).
Testing: Updated ResponseDecoderDestroyedBeforeMessageComplete and added RequestDecoderDestroyedBeforeMessageComplete in codec_impl_test.cc. All tests passed.
Docs Changes: None.
Release Notes: None.
Platform Specific Features: None.

Signed-off-by: Reuben Tanner <reubent@google.com>
Signed-off-by: Reuben Tanner <reubent@google.com>
Signed-off-by: Reuben Tanner <reubent@google.com>
Signed-off-by: Reuben Tanner <reubent@google.com>
@reubent-goog
Copy link
Copy Markdown
Contributor Author

/retest

Error: ERROR: /build/bazel_root/docs/external/bazel_tools/tools/build_defs/repo/http.bzl:136:45: An error occurred during the fetch of repository 'googleurl':
Error: ERROR: @googleurl//build_config:system_icu :: Error loading option @googleurl//build_config:system_icu: java.io.IOException: Error downloading [https://github.com/google/gurl/archive/dd4080fec0b443296c0ed0036e1e776df8813aa7.tar.gz] to /build/bazel_root/docs/external/googleurl/temp7307779263885954944/dd4080fec0b443296c0ed0036e1e776df8813aa7.tar.gz: GET returned 502 Bad Gateway or Proxy Error

@reubent-goog
Copy link
Copy Markdown
Contributor Author

CI keeps failing to download dependencies but the tests are passing and this is ready to review

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.

2 participants