Skip to content

Conversation

is-hoku
Copy link

@is-hoku is-hoku commented Jul 18, 2025

Problem

The test_simple_linux build was failing with a segmentation fault.
I ran this command and got the result.

# make simple_test_linux
./build/test/simple_linux_server &
./build/test/simple_linux_client
cc -O3 -fno-strict-aliasing -c /home/hoku/repo/net-blocks/test/test_simple_linux/server.c -o /home/hoku/repo/net-blocks/build/test/simple_test_linux/server.o -I/home/hoku/repo/net-blocks/runtime -I/home/hoku/repo/net-blocks/scratch
cc -O3 -fno-strict-aliasing -c /home/hoku/repo/net-blocks/test/test_simple_linux/client.c -o /home/hoku/repo/net-blocks/build/test/simple_test_linux/client.o -I/home/hoku/repo/net-blocks/runtime -I/home/hoku/repo/net-blocks/scratch
cc -O3 -fno-strict-aliasing -c /home/hoku/repo/net-blocks/runtime/nb_linux_transport.c -o /home/hoku/repo/net-blocks/build/runtime/nb_linux_transport.o -I /home/hoku/repo/net-blocks/runtime -I /home/hoku/repo/net-blocks/scratch
cc /home/hoku/repo/net-blocks/build/runtime/nb_runtime_simple.o /home/hoku/repo/net-blocks/build/runtime/nb_simple.o /home/hoku/repo/net-blocks/build/runtime/nb_timer.o /home/hoku/repo/net-blocks/build/test/simple_test_linux/server.o /home/hoku/repo/net-blocks/build/runtime/nb_linux_transport.o -o /home/hoku/repo/net-blocks/build/test/simple_linux_server
cc /home/hoku/repo/net-blocks/build/runtime/nb_runtime_simple.o /home/hoku/repo/net-blocks/build/runtime/nb_simple.o /home/hoku/repo/net-blocks/build/runtime/nb_timer.o /home/hoku/repo/net-blocks/build/test/simple_test_linux/client.o /home/hoku/repo/net-blocks/build/runtime/nb_linux_transport.o -o /home/hoku/repo/net-blocks/build/test/simple_linux_client
[1] 1432091
Linux Runtime initialized
Linux Runtime initialized
Segmentation fault (core dumped)

Solution

I modified the initialization sequence to ensure nb__my_host_id is set before calling nb__net_init.
After fixing the code, I got this result.

Linux Runtime initialized
Linux Runtime initialized
Received = Hello from client
Received = Hello from server

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.

1 participant