eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
778 stars 28 forks source link

Creation process hangs pub-sub #149

Closed EmilLindfors closed 6 months ago

EmilLindfors commented 6 months ago

Required information

Operating system: Win 11 Microsoft Windows [Version 10.0.22631.3235]

Rust version: rustc 1.78.0-nightly

Cargo version: Output of: cargo --version

iceoryx2 version: main

Observed result or behaviour: Im getting this error, seems like the creation process hangs:

...
   ix: ".dynamic", creation_timeout: 500ms, 
              connection_suffix: ".connection" } }, def
              aults: Defaults { publish_subscribe: Publ
              ishSubscribe { max_subscribers: 8, max_pu
              blishers: 2, subscriber_max_buffer_size: 
              2, subscriber_max_borrowed_samples: 2, pu
              blisher_max_loaned_samples: 2, publisher_
              history_size: 1, enable_safe_overflow: tr
              ue, unable_to_deliver_strategy: Block }, 
              event: Event { max_listeners: 1, max_noti
              fiers: 16 } } }, _phantom_data: PhantomDa
              ta<iceoryx2::service::zero_copy::Service>
               }
              | Unable to check if the service is avail
              | able since it is currently being create
              | d.
      231 [T] FileBuilder { file_path: FilePath { value
              : FixedSizeByteString<255> { len: 87, dat
              a: "C:\Windows\Temp\iceoryx2\services\iox
              2_8ac634184541a67f312ed9232f19c58ab4e7804
              1.service" } }, access_mode: Read, permis
              sion: OWNER_READ | OWNER_WRITE | OWNER_EX
              EC | OWNER_ALL, has_ownership: false, own
              er: None, group: None, truncate_size: Non
              e, creation_mode: None }
              | opened
      232 [D] "static_storage::file::Storage::does_exis
              t_cfg()"
              | Unable to check if storage "8ac63418454
              | 1a67f312ed9232f19c58ab4e78041" exists s
              | ince the underlying resources are curre
              | ntly being created or the creation proc
              | ess hangs.
      233 [D] BuilderWithServiceType { service_config: 
              StaticConfig { uuid: "8ac634184541a67f312
              ed9232f19c58ab4e78041", service_name: Ser
              viceName { value: FixedSizeByteString<255
              > { len: 20, data: "My/Funk/ServiceName2"
               } }, messaging_pattern: PublishSubscribe
              (StaticConfig { max_subscribers: 8, max_p
              ublishers: 2, history_size: 12, subscribe
              r_max_buffer_size: 5, subscriber_max_borr
              owed_samples: 2, enable_safe_overflow: tr
              ue, type_name: "usize", type_size: 32, ty
              pe_alignment: 16 }) }, global_config: Con
              fig { global: Global { root_path_unix: "/
              tmp/iceoryx2/", root_path_windows: "C:\\W
              indows\\Temp\\iceoryx2\\", prefix: "iox2_
              ", service: Service { directory: "service
              s", publisher_data_segment_suffix: ".publ
              isher_data", static_config_storage_suffix
              : ".service", dynamic_config_storage_suff
              ix: ".dynamic", creation_timeout: 500ms, 
              connection_suffix: ".connection" } }, def
              aults: Defaults { publish_subscribe: Publ
              ishSubscribe { max_subscribers: 8, max_pu
              blishers: 2, subscriber_max_buffer_size: 
              2, subscriber_max_borrowed_samples: 2, pu
              blisher_max_loaned_samples: 2, publisher_
              history_size: 1, enable_safe_overflow: tr
              ue, unable_to_deliver_strategy: Block }, 
              event: Event { max_listeners: 1, max_noti
              fiers: 16 } } }, _phantom_data: PhantomDa
              ta<iceoryx2::service::zero_copy::Service>
               }
              | Unable to check if the service is avail
              | able since it is currently being create
              | d.
      234 [D] Builder { base: BuilderWithServiceType { 
              service_config: StaticConfig { uuid: "8ac
              634184541a67f312ed9232f19c58ab4e78041", s
              ervice_name: ServiceName { value: FixedSi
              zeByteString<255> { len: 20, data: "My/Fu
              nk/ServiceName2" } }, messaging_pattern: 
              PublishSubscribe(StaticConfig { max_subsc
              ribers: 8, max_publishers: 2, history_siz
              e: 12, subscriber_max_buffer_size: 5, sub
              scriber_max_borrowed_samples: 2, enable_s
              afe_overflow: true, type_name: "usize", t
              ype_size: 32, type_alignment: 16 }) }, gl
              obal_config: Config { global: Global { ro
              ot_path_unix: "/tmp/iceoryx2/", root_path
              _windows: "C:\\Windows\\Temp\\iceoryx2\\"
              , prefix: "iox2_", service: Service { dir
              ectory: "services", publisher_data_segmen
              t_suffix: ".publisher_data", static_confi
              g_storage_suffix: ".service", dynamic_con
              fig_storage_suffix: ".dynamic", creation_
              timeout: 500ms, connection_suffix: ".conn
              ection" } }, defaults: Defaults { publish
              _subscribe: PublishSubscribe { max_subscr
              ibers: 8, max_publishers: 2, subscriber_m
              ax_buffer_size: 2, subscriber_max_borrowe
              d_samples: 2, publisher_max_loaned_sample
              s: 2, publisher_history_size: 1, enable_s
              afe_overflow: true, unable_to_deliver_str
              ategy: Block }, event: Event { max_listen
              ers: 1, max_notifiers: 16 } } }, _phantom
              _data: PhantomData<iceoryx2::service::zer
              o_copy::Service> }, verify_number_of_subs
              cribers: false, verify_number_of_publishe
              rs: false, verify_subscriber_max_buffer_s
              ize: true, verify_subscriber_max_borrowed
              _samples: false, verify_publisher_history
              _size: true, verify_enable_safe_overflow:
               true }
              | Unable to open publish subscribe servic
              | e since the service hangs while being c
              | reated, max timeout for service creatio
              | n of 500ms exceeded. Waited for 504.852
              | 1ms but the state did not change.          

Expected result or behaviour: That it would run without any modifications

Conditions where it occurred / Performed steps: ran the two binary pub sub example in README in both debug and release. Also tried changing the config to change the root path, did not help.

elfenpiff commented 6 months ago

@EmilLindfors Thanks for the report.

This could happen when for whatever reason a process is non-gracefully killed. Could you please go into the directory c:\temp\ and remove the directory iceoryx2 and every file starting with the prefix iox2_ and retry again?

Currently, we are working on a mechanism to detect stale resources and clean them up automatically so that you do not have to do this manually. This should come in 0.3.0 beginning of April.

If this does not work, could you please attach the full log file so that I can dig into this.

EmilLindfors commented 6 months ago

Here's the error this time:

     Running `target\release\ox_r.exe`
        0 [D] FileBuilder { file_path: FilePath { value: 
              FixedSizeByteString<255> { len: 20, data: "
              config/iceoryx2.toml" } }, access_mode: Rea
              d, permission: OWNER_READ | OWNER_WRITE | O
              WNER_EXEC | OWNER_ALL, has_ownership: false
              , owner: None, group: None, truncate_size: 
              None, creation_mode: None }
              | Unable to open file since it does not exi
              | st.
        1 [D] Config { global: Global { root_path_unix: "
              /tmp/iceoryx2/", root_path_windows: "C:\\Wi
              ndows\\Temp\\iceoryx2\\", prefix: "iox2_", 
              service: Service { directory: "services", p
              ublisher_data_segment_suffix: ".publisher_d
              ata", static_config_storage_suffix: ".servi
              ce", dynamic_config_storage_suffix: ".dynam
              ic", creation_timeout: 500ms, connection_su
              ffix: ".connection" } }, defaults: Defaults
               { publish_subscribe: PublishSubscribe { ma
              x_subscribers: 8, max_publishers: 2, subscr
              iber_max_buffer_size: 2, subscriber_max_bor
              rowed_samples: 2, publisher_max_loaned_samp
              les: 2, publisher_history_size: 1, enable_s
              afe_overflow: true, unable_to_deliver_strat
              egy: Block }, event: Event { max_listeners:
               1, max_notifiers: 16 } } }
              | Failed to create config since the config 
              | file could not be opened.
        2 [W] "Config::get_global_config()"
              | Unable to load default config file, popul
              | ate config with default values.
< Win32 API error > C:\Users\emill\.cargo\git\checkouts\iceoryx2-1e1d4490bb91753f\9d8c061\iceoryx2-pal\posix\src\windows\unistd.rs:204 GetFileAttributesA(pathname as *const u8)
 [ 3 ] The system cannot find the path specified.        

< Win32 API error > C:\Users\emill\.cargo\git\checkouts\iceoryx2-1e1d4490bb91753f\9d8c061\iceoryx2-pal\posix\src\windows\unistd.rs:204 GetFileAttributesA(pathname as *const u8)
 [ 3 ] The system cannot find the path specified.        

< Win32 API error > C:\Users\emill\.cargo\git\checkouts\iceoryx2-1e1d4490bb91753f\9d8c061\iceoryx2-pal\posix\src\windows\stat.rs:34 GetFileAttributesA(path as *const u8)  
 [ 3 ] The system cannot find the path specified.        

        3 [T] Directory { path: Path { value: FixedSizeBy
              teString<255> { len: 33, data: "C:\Windows\
              Temp\iceoryx2\services" } }, directory_stre
              am: 0x1, file_descriptor: FileDescriptor { 
              value: 0, is_owned: false } }
              | created
        4 [T] Builder { storage_name: FileName { value: F
              ixedSizeByteString<255> { len: 40, data: "8
              ac634184541a67f312ed9232f19c58ab4e78041" } 
              }, has_ownership: false, config: Configurat
              ion { path: Path { value: FixedSizeByteStri
              ng<255> { len: 33, data: "C:\Windows\Temp\i
              ceoryx2\services" } }, suffix: FileName { v
              alue: FixedSizeByteString<255> { len: 8, da
              ta: ".service" } }, prefix: FileName { valu
              e: FixedSizeByteString<255> { len: 5, data:
               "iox2_" } } } }
              | Created service root directory "C:\Window
              | s\Temp\iceoryx2\services" since it did no
              | t exist before.
        5 [T] FileBuilder { file_path: FilePath { value: 
              FixedSizeByteString<255> { len: 87, data: "
              C:\Windows\Temp\iceoryx2\services\iox2_8ac6
              34184541a67f312ed9232f19c58ab4e78041.servic
              e" } }, access_mode: ReadWrite, permission:
               OWNER_READ | OWNER_WRITE | OWNER_EXEC | OW
              NER_ALL, has_ownership: false, owner: None,
               group: None, truncate_size: None, creation
              _mode: Some(CreateExclusive) }
              | created
< Win32 API error > C:\Users\emill\.cargo\git\checkouts\iceoryx2-1e1d4490bb91753f\9d8c061\iceoryx2-pal\posix\src\windows\mman.rs:225 CreateFileA(shm_file_path(name, SHM_STATE_SUFFIX).as_ptr(),
    GENERIC_WRITE | GENERIC_READ,
    FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
    core::ptr::null::<SECURITY_ATTRIBUTES>(), CREATE_NEW,
    FILE_ATTRIBUTE_NORMAL, 0)
 [ 3 ] The system cannot find the path specified.        

        6 [D] SharedMemoryBuilder { name: FileName { valu
              e: FixedSizeByteString<255> { len: 53, data
              : "iox2_8ac634184541a67f312ed9232f19c58ab4e
              78041.dynamic" } }, size: 570, is_memory_lo
              cked: false, has_ownership: false, permissi
              on: OWNER_READ | OWNER_WRITE | OWNER_EXEC |
               OWNER_ALL, creation_mode: Some(CreateExclu
              sive), zero_memory: false, access_mode: Rea
              dWrite, enforce_base_address: None }       
              | Unable to create shared memory since it a
              | lready exists.
        7 [D] Builder { storage_name: FileName { value: F
              ixedSizeByteString<255> { len: 40, data: "8
              ac634184541a67f312ed9232f19c58ab4e78041" } 
              }, supplementary_size: 370, has_ownership: 
              false, config: Configuration { suffix: File
              Name { value: FixedSizeByteString<255> { le
              n: 8, data: ".dynamic" } }, prefix: FileNam
              e { value: FixedSizeByteString<255> { len: 
              5, data: "iox2_" } }, path: Path { value: F
              ixedSizeByteString<255> { len: 25, data: "C
              :\Windows\Temp\iceoryx2\" } } }, _phantom_d
              ata: PhantomData<iceoryx2::service::dynamic
              _config::DynamicConfig> }
              | Failed to create dynamic_storage::PosixSh
              | aredMemory since a shared memory with the
              |  name already exists.
        8 [D] BuilderWithServiceType { service_config: St
              aticConfig { uuid: "8ac634184541a67f312ed92
              32f19c58ab4e78041", service_name: ServiceNa
              me { value: FixedSizeByteString<255> { len:
               20, data: "My/Funk/ServiceName2" } }, mess
              aging_pattern: PublishSubscribe(StaticConfi
              g { max_subscribers: 8, max_publishers: 2, 
              history_size: 12, subscriber_max_buffer_siz
              e: 5, subscriber_max_borrowed_samples: 2, e
              nable_safe_overflow: true, type_name: "usiz
              e", type_size: 32, type_alignment: 16 }) },
               global_config: Config { global: Global { r
              oot_path_unix: "/tmp/iceoryx2/", root_path_
              windows: "C:\\Windows\\Temp\\iceoryx2\\", p
              refix: "iox2_", service: Service { director
              y: "services", publisher_data_segment_suffi
              x: ".publisher_data", static_config_storage
              _suffix: ".service", dynamic_config_storage
              _suffix: ".dynamic", creation_timeout: 500m
              s, connection_suffix: ".connection" } }, de
              faults: Defaults { publish_subscribe: Publi
              shSubscribe { max_subscribers: 8, max_publi
              shers: 2, subscriber_max_buffer_size: 2, su
              bscriber_max_borrowed_samples: 2, publisher
              _max_loaned_samples: 2, publisher_history_s
              ize: 1, enable_safe_overflow: true, unable_
              to_deliver_strategy: Block }, event: Event 
              { max_listeners: 1, max_notifiers: 16 } } }
              , _phantom_data: PhantomData<iceoryx2::serv
              ice::zero_copy::Service> }
              | Failed to create dynamic storage for serv
              | ice.
        9 [D] Builder { base: BuilderWithServiceType { se
              rvice_config: StaticConfig { uuid: "8ac6341
              84541a67f312ed9232f19c58ab4e78041", service
              _name: ServiceName { value: FixedSizeByteSt
              ring<255> { len: 20, data: "My/Funk/Service
              Name2" } }, messaging_pattern: PublishSubsc
              ribe(StaticConfig { max_subscribers: 8, max
              _publishers: 2, history_size: 12, subscribe
              r_max_buffer_size: 5, subscriber_max_borrow
              ed_samples: 2, enable_safe_overflow: true, 
              type_name: "usize", type_size: 32, type_ali
              gnment: 16 }) }, global_config: Config { gl
              obal: Global { root_path_unix: "/tmp/iceory
              x2/", root_path_windows: "C:\\Windows\\Temp
              \\iceoryx2\\", prefix: "iox2_", service: Se
              rvice { directory: "services", publisher_da
              ta_segment_suffix: ".publisher_data", stati
              c_config_storage_suffix: ".service", dynami
              c_config_storage_suffix: ".dynamic", creati
              on_timeout: 500ms, connection_suffix: ".con
              nection" } }, defaults: Defaults { publish_
              subscribe: PublishSubscribe { max_subscribe
              rs: 8, max_publishers: 2, subscriber_max_bu
              ffer_size: 2, subscriber_max_borrowed_sampl
              es: 2, publisher_max_loaned_samples: 2, pub
              lisher_history_size: 1, enable_safe_overflo
              w: true, unable_to_deliver_strategy: Block 
              }, event: Event { max_listeners: 1, max_not
              ifiers: 16 } } }, _phantom_data: PhantomDat
              a<iceoryx2::service::zero_copy::Service> },
               verify_number_of_subscribers: false, verif
              y_number_of_publishers: false, verify_subsc
              riber_max_buffer_size: true, verify_subscri
              ber_max_borrowed_samples: false, verify_pub
              lisher_history_size: true, verify_enable_sa
              fe_overflow: true }
              | Unable to create publish subscribe servic
              | e since the dynamic service segment could
              |  not be created.
elfenpiff commented 6 months ago

@EmilLindfors Ah I see what the problem is. The default temp dir entry in the toml file is pointing to C:\Temp\iceoryx2 but when the toml file is not found the default value is C:\Windows\Temp\iceoryx2

I merged a PR to fix this: #152

When you check out the newest commit in main branch, the real default temp directory is used and everything is stored in C:\Temp\iceoryx2. So when you delete everything in C:\Temp\iceoryx2 and C:\Temp\iox2_* the example should be running.

EmilLindfors commented 6 months ago

Great, that seems to have solved the issue - thanks!