Skip to content

node shmem: Reset Sample::signals before writing to shared memory#1020

Open
leonardocarreras wants to merge 1 commit into
VILLASframework:masterfrom
leonardocarreras:fix-shmem-sample-signal
Open

node shmem: Reset Sample::signals before writing to shared memory#1020
leonardocarreras wants to merge 1 commit into
VILLASframework:masterfrom
leonardocarreras:fix-shmem-sample-signal

Conversation

@leonardocarreras

Copy link
Copy Markdown
Contributor

The shmem node writes samples whose signals field is a std::shared_ptr into the writer's heap. A reader in another process dereferences that pointer while copying the sample and crashes.

Discovered when using two villas-node processes with shmem, it segfaults at the first read.

@stv0g stv0g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/nodes/shmem.cpp Outdated
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
@leonardocarreras
leonardocarreras force-pushed the fix-shmem-sample-signal branch from 3a51577 to f27f241 Compare July 16, 2026 10:10
@leonardocarreras

leonardocarreras commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

I believe this change is better located in shmem_int_write:

https://github.com/leonardocarreras/node/blob/cd0ac2b4577057a3c384f2c2148fa7f78382b374/lib/shmem.cpp#L190

Hi @stv0g, I agree with your suggestion. I moved it there and tested again. Thanks also for the style comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants