elast0ny / shared_memory

A Rust wrapper around native shared memory for Linux and Windows
382 stars 51 forks source link

Running the Event example gives me a Segfault (Linux) #45

Closed 8176135 closed 4 years ago

8176135 commented 4 years ago

When first creating the shmem file, the application will crash with a segmentation fault on this line:

let (evt, used_bytes) = unsafe { Event::new(shmem.as_ptr(), true)? };

Output:

Getting the shared memory mapping
Creating event in shared memory
Segmentation fault (core dumped)

Once the file is created, i.e. shmem.is_owner() is false, then the application runs fine.

Extra info:

I went back to the 0.10.0 commit: 651f889840144713e9e6b0dec10ac5a27f626aca, and ran the basic example, which worked fine.

elast0ny commented 4 years ago

Hey, thanks for the issue.

The problem is related to events on Linux from the raw_sync crate and not this crate. I will investigate the issue and push the fixes to raw_sync.

elast0ny commented 4 years ago

Fixed as part of https://github.com/elast0ny/raw_sync-rs/commit/6944ea10b2f5a2c00cb4f8e6f4dab6a7be63aea9

shared_memory examples should now work properly on linux with raw_sync 0.1.2