Crash maybe related to `nif_erlang_dist_ctrl_put_data`
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c, erlang
- Domain
- backend, operating-systems
Research direction
Start with src/libAtomVM/dist_nifs.c around nif_erlang_dist_ctrl_put_data and follow the backtrace into src/libAtomVM/nifs.c and src/libAtomVM/scheduler.c, especially scheduler_make_ready. Use the linked core dump and the reported test_estdlib.avm crash to investigate the failing lock path. Done when the segmentation fault is reproducibly fixed and the distribution tests pass.
Written by the indexing model from the issue text.
Description
Following crash has been observed here first time: https://github.com/atomvm/AtomVM/actions/runs/18310690206/job/52138386516
coredump is available here:
core-ubuntu-22.04-gcc-11-27-18310690206-1.zip
backtrace:
#0 0x0000563307443688 in smp_spinlock_lock (lock=<optimized out>) at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/smp.h:219
#1 scheduler_make_ready (ctx=ctx@entry=0x7f737802fb30) at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c:352
#2 0x0000563307443fc9 in scheduler_init_ready (c=c@entry=0x7f737802fb30)
at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c:410
#3 0x0000563307435573 in do_spawn (ctx=ctx@entry=0x7f7374025740, new_ctx=0x7f737802fb30, arity=<optimized out>,
n_freeze=<optimized out>, opts_term=<optimized out>) at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c:1317
#4 0x0000563307435c93 in nif_erlang_spawn_opt (ctx=ctx@entry=0x7f7374025740, argc=argc@entry=4, argv=argv@entry=0x7f737f9fecc0)
at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c:1424
#5 0x0000563307454c0c in nif_erlang_dist_ctrl_put_data (argv=0x7f7374025770, argc=<optimized out>, ctx=0x7f7374025740)
at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/dist_nifs.c:611
#6 nif_erlang_dist_ctrl_put_data (ctx=0x7f7374025740, argc=<optimized out>, argv=0x7f7374025770)
at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/dist_nifs.c:448
#7 0x00005633073a6a17 in scheduler_entry_point (glb=0x56332ee782a0)
at /home/runner/work/AtomVM/AtomVM/src/libAtomVM/opcodesswitch.h:2027
#8 0x00005633074615d6 in scheduler_thread_entry_point (arg=<optimized out>)
at /home/runner/work/AtomVM/AtomVM/src/platforms/generic_unix/lib/smp.c:75
#9 0x00007f737fa94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
Last observed messages from test_estdlib.avm:
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=binary ListenActive=false ConnectActive=false
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=binary ListenActive=false ConnectActive=true
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=binary ListenActive=true ConnectActive=false
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=binary ListenActive=true ConnectActive=true
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=list ListenActive=false ConnectActive=false
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=list ListenActive=false ConnectActive=true
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=list ListenActive=true ConnectActive=false
GEN_TCP-TEST> ServerBackendOption=[{inet_backend,inet}] ClientBackendOption=[{inet_backend,inet}] ListenMode=list ConnectMode=list ListenActive=true ConnectActive=true
CRASH
======
pid: <0.1931.0>
Stacktrace:
[{socket_dist_controller,recv_data_loop,1,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/socket_dist_controller.erl"},{line,173}]},{socket_dist_controller,handle_info,2,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/socket_dist_controller.erl"},{line,161}]},{gen_server,loop,3,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/gen_server.erl"},{line,551}]}]
cp: #CP<module: 70, label: 51, offset: 27>
x[0]: error
x[1]: {case_clause,{error,closed}}
x[2]: {3,3,138,2,[{4,3156},{70,1118},{70,1554}],error}
Stack
-----
[]
{state,{<<"">>,#Ref<0.0.5879>},<<"">>,#Ref<0.0.5904>,<<"">>,3,1}
#CP<module: 70, label: 44, offset: 69>
#CP<module: 4, label: 112, offset: 21>
[]
[]
[]
{state,{<<"">>,#Ref<0.0.5879>},<<"">>,#Ref<0.0.5904>,<<"">>,3,1}
[]
{state,undefined,socket_dist_controller,{state,{<<"">>,#Ref<0.0.5879>},<<"">>,#Ref<0.0.5904>,<<"">>,3,1}}
<0.1930.0>
#CP<module: 4, label: 137, offset: 0>
Mailbox
-------
Monitors
--------
link to <0.1932.0>
monitored by resource 0x7f73700072f8 ref=5895
monitored by resource 0x7f73780042b8 ref=5899
**End Of Crash Report**
++dist_util: shutting down connection dist_util:529, data={otp@runnervmafkv5,invalid_challenge}, reason=shutdown
CRASH
======
pid: <0.1962.0>
Stacktrace:
[{erpc,execute_call,4,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/erpc.erl"},{line,59}]}]
cp: #CP<module: 72, label: 2, offset: 27>
x[0]: exit
x[1]: {#Ref<1666.3375636846.2655256579.102929>,return,"ATOM"}
x[2]: {1,1,57,1,[{72,125}],exit}
Stack
-----
[]
#Ref<1666.3375636846.2655256579.102929>
[]
#CP<module: 72, label: 12, offset: 0>
Mailbox
-------
Monitors
--------
monitored by resource 0x56332ee9b468 ref=5984
**End Of Crash Report**
CRASH
======
pid: <0.1959.0>
Stacktrace:
[{socket_dist_controller,recv_data_loop,1,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/socket_dist_controller.erl"},{line,173}]},{socket_dist_controller,handle_info,2,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/socket_dist_controller.erl"},{line,161}]},{gen_server,loop,3,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/gen_server.erl"},{line,551}]}]
cp: #CP<module: 70, label: 51, offset: 27>
x[0]: error
x[1]: {case_clause,{error,closed}}
x[2]: {3,3,138,2,[{4,3156},{70,1118},{70,1554}],error}
Stack
-----
[]
{state,{<<"">>,#Ref<0.0.5962>},<<"">>,#Ref<0.0.5985>,<<"">>,1,2}
#CP<module: 70, label: 44, offset: 69>
#CP<module: 4, label: 112, offset: 21>
[]
[]
[]
{state,{<<"">>,#Ref<0.0.5962>},<<"">>,#Ref<0.0.5985>,<<"">>,1,2}
[]
{state,undefined,socket_dist_controller,{state,{<<"">>,#Ref<0.0.5962>},<<"">>,#Ref<0.0.5985>,<<"">>,1,2}}
<0.1958.0>
#CP<module: 4, label: 137, offset: 0>
Mailbox
-------
Monitors
--------
link to <0.1960.0>
monitored by resource 0x56332ee9b468 ref=5978
monitored by resource 0x7f737802eb18 ref=5982
**End Of Crash Report**
CRASH
======
pid: <0.1977.0>
Stacktrace:
[{erpc,execute_call,4,[{file,"/home/runner/work/AtomVM/AtomVM/libs/estdlib/src/erpc.erl"},{line,59}]}]
cp: #CP<module: 72, label: 2, offset: 27>
x[0]: exit
x[1]: {#Ref<1666.456103427.2923954179.64219>,return,"ATOM"}
x[2]: {1,1,57,1,[{72,125}],exit}
Stack
-----
#Ref<1666.456103427.2923954179.64219>
[]
#CP<module: 72, label: 12, offset: 0>
Mailbox
-------
Monitors
--------
monitored by resource 0x7f7370029548 ref=6030
**End Of Crash Report**
/home/runner/work/_temp/c1c1be6a-d0ae-48dc-b96f-91741858de62.sh: line 3: 17204 Segmentation fault (core dumped) ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
Error: Process completed with exit code 139.
It has been observed also here:
https://github.com/atomvm/AtomVM/actions/runs/18310690206/job/52138386539
- Dominant language
- Erlang
- Stars
- 2.3k
- Forks
- 171
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from atomvm/AtomVM
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
lwIP sockets: a failed listen or connect leaves the socket lock held, a later close hangs foreverOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
milind-soni/OpenMausBot#5829 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OHDSI/Data2Evidence#3693 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kubernetes-sigs/headlamp#8408 ·
Maintainers usually reply within 1 day