Open xxshady opened 1 month ago
@xxshady I can confirm the bug, also partially on Linux. It is actually two separate issues.
The cause is event_listener.blocking_wait_one()
in the listener.rs
. When you press CTRL+c you send a SIGINT/SIGTERM signal and cause the application to abnormally terminate since no signal handler was registered and then also the resources of the process are not cleaned up.
If you adjust the code to this, the termination signal should be handled cleanly.
// you need to add iceoryx2-bb-posix as dependency into your Cargo.toml
use iceoryx2_bb_posix::signal::*;
// ...
while !SignalHandler::termination_requested() {
match event_listener.blocking_wait_one() {
Ok(Some(id)) => println!("woke up {id:?}"),
Ok(None) => (),
Err(_) => break,
}
}
So whenever you have a blocking call you need to register some kind of signal handler so that the application can cleanly terminate when CTRL+c is pressed.
Another issue is, that we have introduced with v0.4. a stale resource cleanup when a node crashes or does not cleanup the resources. Then another node takes over and cleans the resources. On Linux it is working and you see something like:
6 [W] "Node::<iceoryx2::service::ipc::Service>::cleanup_dead_nodes()"
| Dead node (NodeId(UniqueSystemId { value: 1667667095615766886193595845
| , pid: 34245, creation_time: Time { clock_type: Realtime, seconds: 172
| 8553806, nanoseconds: 90404414 } })) detected
In your case this should happen as well but it seems there is a problem on Windows.
Not sure if it's a bug, probably somehow related to this?
Required information
Operating system: Windows 11, 23H2,
ver
:Microsoft Windows [Version 10.0.22631.4169]
Rust version: rustc 1.81.0 (eeb90cda1 2024-09-04)
Cargo version: cargo 1.81.0 (2dbb1af80 2024-08-20)
iceoryx2 version: 0.4.1
Detailed log output:
Details
``` Running `target\debug\host.exe` 0 [D] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 20, data: "config/iceoryx2.toml" } }, access_mode: Read, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, creation_mode: None } | Unable to open file since it does not exist. 1 [D] Config { global: Global { root_path_unix: Path { value: FixedSizeByteString<255> { len: 14, data: "/tmp/iceoryx2/" } }, root_path_windows: Path { value: FixedSizeByteString<255> { len: 17, data: "c:\Temp\iceoryx2\" } }, prefix: FileName { value: FixedSizeByteString<255> { len: 5, data: " iox2_" } }, service: Service { directory: Path { value: FixedSizeByteString<255> { len: 8, data: "services" } }, publisher_data_segment_suffix: FileName { value: FixedSizeByteString<255> { len: 15, data: ".publisher_data" } }, static_config_storage_suffix: FileName { value: FixedSizeByte String<255> { len: 8, data: ".service" } }, dynamic_config_storage_suffix: FileName { value: FixedSizeByteString<255> { len: 8, data: ".dynamic" } }, creation_timeout: 500ms, connection_suffix: FileName { value: FixedSizeByteString<255> { len: 11, data: ".connection" } }, event_connectio n_suffix: FileName { value: FixedSizeByteString<255> { len: 6, data: ".event" } } }, node: Node { directory: Path { value: FixedSizeByteString<2 55> { len: 5, data: "nodes" } }, monitor_suffix: FileName { value: FixedSizeByteString<255> { len: 13, data: ".node_monitor" } }, static_config_ suffix: FileName { value: FixedSizeByteString<255> { len: 8, data: ".details" } }, service_tag_suffix: FileName { value: FixedSizeByteString<255 > { len: 12, data: ".service_tag" } }, cleanup_dead_nodes_on_creation: true, cleanup_dead_nodes_on_destruction: true } }, defaults: Defaults { p ublish_subscribe: PublishSubscribe { max_subscribers: 8, max_publishers: 2, max_nodes: 20, subscriber_max_buffer_size: 2, subscriber_max_borrowe d_samples: 2, publisher_max_loaned_samples: 2, publisher_history_size: 1, enable_safe_overflow: true, unable_to_deliver_strategy: Block, subscri ber_expired_connection_buffer: 128 }, event: Event { max_listeners: 2, max_notifiers: 16, max_nodes: 36, event_id_max_value: 32 } } } | Failed to create config since the config file could not be opened. 2 [W] "Config::global_config()" | Default config file found but unable to read data, populate config with default values. 3 [T] Directory { path: Path { value: FixedSizeByteString<255> { len: 51, data: "c:\Temp\iceoryx2\nodes\2344370886309983727313240896" } }, directory_s tream: 0x2, file_descriptor: FileDescriptor { value: 0, is_owned: false } } | created 4 [T] Builder { storage_name: FileName { value: FixedSizeByteString<255> { len: 4, data: "node" } }, has_ownership: false, config: Configuration { pat h: Path { value: FixedSizeByteString<255> { len: 51, data: "c:\Temp\iceoryx2\nodes\2344370886309983727313240896" } }, suffix: FileName { value: FixedSizeByteString<255> { len: 8, data: ".details" } }, prefix: FileName { value: FixedSizeByteString<255> { len: 5, data: "iox2_" } } } } | Created service root directory "c:\Temp\iceoryx2\nodes\2344370886309983727313240896" since it did not exist before. 5 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 69, data: "c:\Temp\iceoryx2\nodes\2344370886309983727313240896\iox2_n ode.details" } }, access_mode: ReadWrite, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, crea tion_mode: Some(CreateExclusive) } | created 6 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 80, data: "c:\Temp\iceoryx2\nodes\iox2_2344370886309983727313240896.n ode_monitor_owner_lock" } }, access_mode: ReadWrite, permission: Permission(448), has_ownership: true, owner: None, group: None, truncate_size: None, creation_mode: Some(CreateExclusive) } | created 7 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 69, data: "c:\Temp\iceoryx2\nodes\iox2_2344370886309983727313240896.n ode_monitor" } }, access_mode: ReadWrite, permission: Permission(128), has_ownership: true, owner: None, group: None, truncate_size: None, creat ion_mode: Some(CreateExclusive) } | created 8 [T] "ProcessGuard::new()" | create process state "c:\Temp\iceoryx2\nodes\iox2_2344370886309983727313240896.node_monitor" for monitoring 9 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 79, data: "c:\Temp\iceoryx2\services\iox2_b658a14a058f0680bd49c7d22c2 00d81a4c0670c.service" } }, access_mode: Read, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, creation_mode: None } | opened 10 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 79, data: "c:\Temp\iceoryx2\services\iox2_b658a14a058f0680bd49c7d22c2 00d81a4c0670c.service" } }, access_mode: Read, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, creation_mode: None } | opened 11 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 79, data: "c:\Temp\iceoryx2\services\iox2_b658a14a058f0680bd49c7d22c2 00d81a4c0670c.service" } }, access_mode: Read, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, creation_mode: None } | opened 12 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 79, data: "c:\Temp\iceoryx2\services\iox2_b658a14a058f0680bd49c7d22c2 00d81a4c0670c.service" } }, access_mode: Read, permission: Permission(448), has_ownership: false, owner: None, group: None, truncate_size: None, creation_mode: None } | opened 13 [T] FileBuilder { file_path: FilePath { value: FixedSizeByteString<255> { len: 109, data: "c:\Temp\iceoryx2\nodes\2344370886309983727313240896\iox2_ b658a14a058f0680bd49c7d22c200d81a4c0670c.service_tag" } }, access_mode: ReadWrite, permission: Permission(448), has_ownership: false, owner: Non e, group: None, truncate_size: None, creation_mode: Some(CreateExclusive) } | created < Win32 API error > C:\Users\xshad\.cargo\registry\src\index.crates.io-6f17d22bba15001f\iceoryx2-pal-posix-0.4.1\src\windows\mman.rs:174 OpenFileMappingA(FILE_MAP_ALL_ACCESS, false as i32, name as *const u8) [ 2 ] The system cannot find the file specified. 14 [D] SharedMemoryBuilder { name: FileName { value: FixedSizeByteString<255> { len: 94, data: "iox2_305ad9523c6b202364d581359ec3d2c5743e42e7_b658a14a0 58f0680bd49c7d22c200d81a4c0670c.dynamic" } }, size: 0, is_memory_locked: false, has_ownership: true, permission: Permission(448), creation_mode: None, zero_memory: true, access_mode: ReadWrite, enforce_base_address: None } | Unable to open shared memory since the shared memory does not exist. 15 [D] Builder { storage_name: FileName { value: FixedSizeByteString<255> { len: 40, data: "b658a14a058f0680bd49c7d22c200d81a4c0670c" } }, supplementar y_size: 0, has_ownership: false, config: Configuration { suffix: FileName { value: FixedSizeByteString<255> { len: 8, data: ".dynamic" } }, pref ix: FileName { value: FixedSizeByteString<255> { len: 5, data: "iox2_" } }, path: Path { value: FixedSizeByteString<255> { len: 17, data: "c:\Te mp\iceoryx2\" } }, _data: PhantomDataObserved result or behaviour: event notifier:
event listener:
Expected result or behaviour: No error or at least more readable one?
Conditions where it occurred / Performed steps: For the first time notifier and listener run correctly, the second time win32 errors occur (ctrl+c, cargo run again)