[#1898] Add test coverage for signal-isolation behavior - #1900
[#1898] Add test coverage for signal-isolation behavior#1900zacheryasc wants to merge 3 commits into
Conversation
|
Reasoning for the change in the epoll test behavior:
|
|
Reasoning for the change in the signalfd test behavior:
|
…rvation defect A signal subscribed via `EpollBuilder::handle_signal` must be delivered as `EpollEvent::Signal` even when the global `SignalHandler` has claimed the disposition of that signal. Today the claim starves the epoll internal signalfd: the subscribed signal is never blocked for the fd, so `capture_signal` consumes it first and the test fails. It stays `#[ignore]`d until the eclipse-iceoryx#1898 fix lands; removing the ignore then verifies the fix. Replaces the old retry-loop + 1000 s watchdog with a single process-directed send and a bounded `timed_wait`, so a starved epoll fails in ~200 ms instead of hanging on the watchdog. Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
…on regression tests A signal subscribed on a `SignalFd` must be delivered to the fd even against competing SignalHandler calls. This implements the test guards to ensure any fix for eclipse-iceoryx#1898 encodes the desired behavior. `registered_signal_can_be_try_read` is rewritten from an unbounded loop that hangs when the fd is starved into a bounded ~200 ms poll with explicit handler activation, so a starved fd fails fast with a precise assertion instead of spinning forever. Two regression guards pin the isolation contract any fix must preserve: `dropped_signal_fd_restores_handler_visibility` (dropping a fd must not leave its signal monopolized away from the global handler) and `signal_fd_does_not_mask_unsubscribed_signal` (owning one signal must not suppress delivery of an unrelated signal). Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
7dd3a8b to
f4c3ab8
Compare
|
Final coverage implemented. The reasoning for the change in signal test behavior:
|
f4c3ab8 to
f6caab6
Compare
Replace the deadlocking `call_and_fetch_with_registered_handler_works` guard with three tests: - does_not_observe_unrelated_concurrent_signal [ignored]: a signal on another thread must not leak into a capture (eclipse-iceoryx#1898 race). - observes_signal_directed_at_calling_thread: a self-directed signal must be captured (positive counterpart, passes today). - with_registered_callback_completes [ignored]: capture + callback on the same signal must not deadlock, and both must be observed (eclipse-iceoryx#1458). Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
|
@elBoberido This should provide coverage for the general problem exposed from our previous conversation. This PR and the associated issue is ready for review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1900 +/- ##
==========================================
+ Coverage 76.21% 76.30% +0.09%
==========================================
Files 452 454 +2
Lines 45109 45404 +295
Branches 1436 1436
==========================================
+ Hits 34378 34645 +267
- Misses 9525 9553 +28
Partials 1206 1206
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@elBoberido ping. This adds deterministic test coverage for race behavior and more when dealing with posix signals. It makes some extant tests more clear and straightforward, and checks for more possible violations of correct behavior. |
|
@zacheryasc sorry, this totally slipped my attention. Maybe @elfenpiff can take a look at the PR. He is deeper into this part of the code. I once had a brief look at the code in |
The issue, speaking broadly, is that posix signals are just very uncomfortable for concurrency, and twist your arm into building a singleton-router-ish signal handler. So we might solve single thread in such a way, but mutlithread is a different beast. I didn't make any architectural decisions here, though, except implied concurrency via the test construction. This is just setting guardrails to make correctness more explicit. |
The purpose is to complete test coverage that asserts the behavior #1898 prescribes, so a future fix PR can be validated against it. This PR does not fix #1898.
Coverage is spread across three test files:
iceoryx2-bb/linux/tests-common/src/epoll_tests.rs— a signal subscribed viaEpollBuilder::handle_signalis delivered asEpollEvent::Signaldespite the global handler claiming the dispositioniceoryx2-bb/linux/tests-common/src/signal_fd_tests.rs— signalfd deliveryiceoryx2-bb/posix/tests-common/src/signal_tests.rs—call_and_fetchper-thread isolation, and thesignal_test::signal_call_and_fetch_with_registered_handler_works()deadlocks in single-threaded execution #1458 contention caseNotes for Reviewer
design; a fix PR un-ignores them as proof.
in ~0.2 s (no hang, no watchdog trip).
Pre-Review Checklist for the PR Author
Convert to draft)iox2-123-introduce-posix-ipc-example)[#123] Add posix ipc example)PR Reviewer Reminders
References
Relates to #1898 #1458