Skip to content

test: mock close on fake socket in HttpInspectorTest - #48495

Merged
yanavlasov merged 1 commit into
envoyproxy:mainfrom
antoniovleonti:fix_bug_545097480
Oct 22, 2026
Merged

yanavlasov merged 1 commit into
envoyproxy:mainfrom
antoniovleonti:fix_bug_545097480

Conversation

@antoniovleonti

Copy link
Copy Markdown
Contributor

Commit Message: test: mock close on fake socket in HttpInspectorTest
Additional Description:
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

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
antoniovleonti marked this pull request as draft October 21, 2026 02:38
@antoniovleonti
antoniovleonti marked this pull request as ready for review October 21, 2026 18:25
@yanavlasov
yanavlasov merged commit c929fa2 into envoyproxy:main Oct 22, 2026
27 checks passed
@antoniovleonti
antoniovleonti deleted the fix_bug_545097480 branch October 22, 2026 15:48
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]>
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