Closed
Description
Required information
Operating system:
Windows 11 23H2 (22635.4655)
Rust version:
rustc 1.82.0 (f6e511eec 2024-10-15)
Cargo version:
cargo 1.82.0 (8f40fc59f 2024-08-21)
iceoryx2 version:
0.5.0
Observed result or behaviour:
In the publish_subscribe_dynamic_data
example, the publisher cannot send u8 slice exceeding 8 MiB. It can be reproduced by
--- a/examples/rust/publish_subscribe_dynamic_data/publisher.rs
+++ b/examples/rust/publish_subscribe_dynamic_data/publisher.rs
@@ -35,10 +35,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.allocation_strategy(AllocationStrategy::PowerOfTwo)
.create()?;
- let mut counter = 0;
+ let mut counter = 1;
while node.wait(CYCLE_TIME).is_ok() {
- let required_memory_size = (counter + 1) * (counter + 1);
+ let required_memory_size = counter;
let sample = publisher.loan_slice_uninit(required_memory_size)?;
let sample = sample.write_from_fn(|byte_idx| ((byte_idx + counter) % 255) as u8);
@@ -49,7 +49,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
counter, required_memory_size
);
- counter += 1;
+ counter *= 2;
}
println!("exit");
The publisher crashes with error
< Win32 API error > iceoryx2-pal\posix\src\windows\mman.rs:332 MapViewOfFile(win_handle.handle.handle, FILE_MAP_ALL_ACCESS, 0, 0, len)
[ 5 ] Access is denied.
81 [F] SharedMemory { name: FileName { value: FixedSizeByteString<255> { len: 99, data: "iox2_0354a209029e7d094a819e2d4030ea33
1e6caaf0_3892_97239722077290829675606576948__10.publisher_data" } }, size: 1140850967, base_address: 0x0, has_ownership
: true, file_descriptor: FileDescriptor { value: 5, is_owned: true }, memory_lock: None }
| This should never happen! A valid shared memory object should never contain a base address with null value.
thread 'main' panicked at iceoryx2-bb\posix\src\shared_memory.rs:484:17:
From: SharedMemory { name: FileName { value: FixedSizeByteString<255> { len: 99, data: "iox2_0354a209029e7d094a819e2d4030ea331e6caaf0_3892_97239722077290829675606576948__10.publisher_data" } }, size: 1140850967, base_address: 0x0, has_ownership: true, file_descriptor: FileDescriptor { value: 5, is_owned: true }, memory_lock: None } ::: This should never happen! A valid shared memory object should never contain a base address with null value.
According to my test, the maximum length of u8 slice that can be successfully sent is .8192 * 1024 - 100 + 64