Skip to content

test: fix null async tcp client dereference in tcp_async_client_integration_test#46109

Open
davidvo-lyft wants to merge 1 commit into
envoyproxy:mainfrom
davidvo-lyft:davidvo/43233-tcp-async-client-flake
Open

test: fix null async tcp client dereference in tcp_async_client_integration_test#46109
davidvo-lyft wants to merge 1 commit into
envoyproxy:mainfrom
davidvo-lyft:davidvo/43233-tcp-async-client-flake

Conversation

@davidvo-lyft

@davidvo-lyft davidvo-lyft commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

test_network_async_tcp_filter destroys its AsyncTcpClient in the first onData() when kill_after_on_data is set. With half close enabled, the payload and FIN can arrive as two separate read dispatches, and the second dispatch dereferenced the destroyed client (segfault, the CI flake in #43233). The coalescing is nondeterministic, which is why the flake was hard to reproduce. This guards the filter onData() and downstream onEvent() paths against a null client and adds a ClientTearDownSplitFin regression test that always delivers the FIN as a separate read event.

Commit Message: test: fix null async tcp client dereference in tcp_async_client_integration_test

Additional Description: see above

Risk Level: Low. Test only, no production code change.

Testing:

  • ClientTearDownSplitFin fails 20 out of 20 runs on main (segfault, faulting address 0x0 in the downstream read dispatch, matching the issue) and passes with the guards.
  • Full //test/integration:tcp_async_client_integration_test target: 200 out of 200 runs pass (--runs_per_test=200) in the CI clang image.
  • check_format passes.

Docs Changes: N/A

Release Notes: N/A (test only)

Platform Specific Features: N/A

Fixes #43233

Generative AI disclosure: Developed with AI assistance (Claude Code); I reviewed and understand every line and take full ownership of the submission.

…ration_test

With half close enabled, the downstream payload and FIN can arrive at the
test network filter in two separate read dispatches. The first dispatch
destroys the async client via the kill_after_on_data path, and the second
dispatch dereferenced the destroyed client and segfaulted, which is the
CI flake reported in issue envoyproxy#43233. Guard the filter onData and downstream
onEvent paths against a null client, and add a ClientTearDownSplitFin
regression test that delivers the FIN as a separate read event to
reproduce the crash deterministically.

Signed-off-by: David Vo <davidvo@lyft.com>
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.

tcp_async_client_integration_test is flaky

1 participant