Repository navigation
test: mock close on fake socket in HttpInspectorTest - #48495
Merged
Merged
Conversation
In HttpInspectorTest, io_handle_ is instantiated with fake socket fd 42. Because os_sys_calls_.close() was not mocked, destroying io_handle_ invoked ::close(42) on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock close() to return success without closing the descriptor, matching TlsInspectorTest and TlsInspectorJa4Test. Signed-off-by: antoniovleonti <[email protected]>
antoniovleonti
marked this pull request as draft
October 21, 2026 02:38
antoniovleonti
marked this pull request as ready for review
October 21, 2026 18:25
yanavlasov
approved these changes
Oct 22, 2026
jwendell
pushed a commit
that referenced
this pull request
Nov 12, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
that referenced
this pull request
Nov 17, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
In `HttpInspectorTest`, `io_handle_` is instantiated with fake socket fd 42. Because `os_sys_calls_.close()` was not mocked, destroying `io_handle_` invoked `::close(42)` on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42. Mock `close()` to return success without closing the descriptor, matching `TlsInspectorTest` and `TlsInspectorJa4Test`. Risk Level: Low (test-only) Testing: `//test/extensions/filters/listener/http_inspector:http_inspector_test` under TSAN (100 runs) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: antoniovleonti <[email protected]> (cherry picked from commit c929fa2) Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message: test: mock close on fake socket in HttpInspectorTest
Additional Description:
In
HttpInspectorTest,io_handle_is instantiated with fake socket fd 42. Becauseos_sys_calls_.close()was not mocked, destroyingio_handle_invoked::close(42)on the OS. If another thread opened or was using fd 42 (e.g. an internal eventfd or pipe), closing it caused a TSAN data race on fd 42.Mock
close()to return success without closing the descriptor, matchingTlsInspectorTestandTlsInspectorJa4Test.Risk Level: Low (test-only)
Testing:
//test/extensions/filters/listener/http_inspector:http_inspector_testunder TSAN (100 runs)Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A