Closed elfenpiff closed 1 month ago
When set_log_level(LogLevel::TRACE)
is active one test fails with this:
ServiceEventTest/0.open_or_create_service_does_exist
353 [D] Builder { storage_name: FileName { value: FixedSizeByteString<255> { len: 40, data: "26380db3f2d1d21a17def8273faec2e5097cf3e2" } }, supplementary_size: 0, ha
s_ownership: false, config: Configuration { suffix: FileName { value: FixedSizeByteString<255> { len: 8, data: ".dynamic" } }, prefix: FileName { value: FixedSizeByteStrin
g<255> { len: 5, data: "iox2_" } }, path: Path { value: FixedSizeByteString<255> { len: 14, data: "/tmp/iceoryx2/" } }, _data: PhantomData<iceoryx2::service::dynamic_confi
g::DynamicConfig> }, timeout: 500ms, initializer: , _phantom_data: PhantomData<iceoryx2::service::dynamic_config::DynamicConfig> }
| Failed to open since the version number was not set - (it is not initialized after 500ms).
Which then lead to a failure when opening the dynamic service info and then the builder assumes the services is in a corrupted state. This comes only up with bazel, never occurs with cmake or with Rust (which has the same test)
The mechanism that seems to fail here is the concurrent dynamic storage creation/opening for the ipc::Service
. To support concurrent creation/opening the creation must somehow tell the opener that the initialization is still in progress. This is done with two mechanisms:
When the opener comes it first checks if it has read/write permissions, if not, initialization is still in progress. If it has read/write permissions it also checks the version number. If it is zero, still in initialization, if not zero it must match its own local version number.
Okay, there was an actual bug in the dynamic storage posix shared memory implementation. When the creation process is still initializing the memory, the opener takes a COPY of the version number instead of a pointer to it and checks it until it becomes non-zero.
The thing is, this is a bug that should only occur on OSes that do not support adjusting the permissions of the shm during runtime like Mac OS and Windows and not linux.
And this also does not fix the failing test
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 78.92%. Comparing base (
cd27eee
) to head (b3dfa90
). Report is 27 commits behind head on main.
Notes for Reviewer
Fixes some parts of the problem but not everything
Pre-Review Checklist for the PR Author
SPDX-License-Identifier: Apache-2.0 OR MIT
iox2-123-introduce-posix-ipc-example
)[#123] Add posix ipc example
)task-list-completed
)Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Relates to #349 Closes #475