SHM Bus Error - simple way to reproduce
This repo contains a simple way to reproduce:
* thread #1, name = 'runtime', stop reason = signal SIGBUS
* frame #0: 0x00007f2bbf217c4a libc.so.6`___lldb_unnamed_symbol4288 + 778
frame #1: 0x0000561341ed9d90 runtime`zenoh_transport::common::pipeline::TransmissionPipelineProducer::push_zenoh_message::h7c958c9f309b90eb [inlined] core::intrinsics::copy_nonoverlapping::h3a80de1563bd0d1e at intrinsics.rs:2363:9
frame #2: 0x0000561341ed9d7c runtime`zenoh_transport::common::pipeline::TransmissionPipelineProducer::push_zenoh_message::h7c958c9f309b90eb at mod.rs:1948:18
How to run (pubslisher)
First configure your docker host to allow core dumps:
echo '/tmp/core.%p' | sudo tee /proc/sys/kernel/core_pattern
Then you need to build the images:
cd pub
./build-image.sh
cd ../sub
./build-image.sh
Finally you can run: docker compose up
After some time (at least on Ubuntu focal, x86 hosts), it will fail with
shm-bus-error-pub-1 | Bus error (core dumped)
Inspect the core dump
Once the container is failed export it as an image and run a shell in it.
docker commit shm-bus-error-pub-1 pub-core-dump
docker run -it pub-core-dump bash
# X is the PID so in your case replace it with the actual name of the file
lldb /shm-bus-error/target/debug/shm-bus-error -c /tmp/core.X
How to run (channel)
$ docker run -it -e SIZE=1024000 -e ELEMS=100 --name shm-chan gabrik91/shm-channel"
Shared Memory size in docker can be changed by --shm-size=70M
Inspect the core dump
Once the container is failed export it as an image and run a shell in it.
docker commit shm-chan chan-core-dump
docker run -it chan-core-dump bash
# X is the PID so in your case replace it with the actual name of the file
lldb /shm-bus-error/target/debug/shm-channel -c /tmp/core.X