Skip to content

Resources cannot always be cleaned up with 'dev_permissions' feature flag #1370

Description

@elBoberido

Before posting the bug, take a look at the
FAQ
for a possible solution.

Required information

Operating system:

  • Linux, 2.19
  • other OSes are probably also affected

Rust version:

any

Cargo version:

any

iceoryx2 version:

Probably present since the introduction of the dev_permissions feature flag

Detailed log output:

1 [E] SharedMemory { name: FileName { value: StaticString<255> { len: 80, data: "iox2_0354a209029e7d094a819e2d4030ea331e6caaf0_95202013074162211780128991149.data" } }, has_ownership: AtomicBool(true), memory_mapping: MemoryMapping { file_descriptor: Some(FileDescriptor { value: 6, is_owned: true }), file_path: None, base_address: 0x7f12e807c000, size: 2470, offset: 0 }, memory_lock: None, mapping_offset: 0 }
| Failed to cleanup shared memory since the permissions could not be adjusted (InsufficientPermissions).
2 [E] "Service::remove_node_from_service(NodeId(UniqueSystemId { value: 15948803921282728757882316717, pid: 59309, creation_time: Time { clock_type: Monotonic, seconds: 14295, nanoseconds: 864586393 } }), ServiceId(RestrictedFileName { value: StaticString<64> { len: 40, data: "4eacadf2695a3f4b2eb95485759246ce1a2aa906" } }))"
| Unable to remove static config of unused service (InternalError).
3 [E] "Service::remove_node_from_service(NodeId(UniqueSystemId { value: 15948803921282728757882316717, pid: 59309, creation_time: Time { clock_type: Monotonic, seconds: 14295, nanoseconds: 864586393 } }), ServiceId(RestrictedFileName { value: StaticString<64> { len: 40, data: "4eacadf2695a3f4b2eb95485759246ce1a2aa906" } }))"
| Unable to remove static config of unused service (InternalError).
Error: PublishSubscribeOpenError(IsMarkedForDestruction)

Observed result or behaviour:

When the dev_permissions flag is used, any app is entitles to perform the cleanup. But when an app terminates abnormally and the app to cleanup runs under a different user than the one that terminated, the permission cannot be changed and the error with the log from above occurs.

Expected result or behaviour:

The cleanup works with the dev_permissions feature flag even it the resources to be cleaned up were created by an application running under a different user.

Conditions where it occurred / Performed steps:

Terminal 1:

cargo build --example publish_subscribe_publisher --features iceoryx2/dev_permissions
sudo -u testuser -- target/debug/examples/publish_subscribe_publisher

Terminal 2:

sudo killall -9 publish_subscribe_publisher
target/debug/examples/publish_subscribe_publisher

Underlying issue:

Changing the file permissions to have write access before deleting the file is required (at least) on Windows. At some locations, the failure to change the file permissions generates only a warning instead of an error. It needs to be checked whether the same approach also works for the set_permission call in:

  • iceoryx2-cal/src/static_storage/file.rs
  • iceoryx2-bb/posix/src/shared_memory.rs

If not, the change of the permissions needs to be abstracted away is the PAL layer and performed only on the platforms that require this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions