Skip to content

Commit

Permalink
[erts] Fix auto connect from net_kernel
Browse files Browse the repository at this point in the history
This bug was harmless. Prior to ff7daac
(on master prior to OTP-26.0-rc3) net_kernel never triggered auto connect
itself. After that commit, when net_kernel triggered auto connect, the
runtime system would try-lock the main-lock on net_kernel while executing
net_kernel when sending a message to net_kernel. An assertion would trigger,
but in the optimized runtime this would just cause the try-lock to fail
and the message to unnecessarily to be placed in a heap-fragment.
  • Loading branch information
rickard-green committed Apr 4, 2023
1 parent 57fe1d1 commit 3896876
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions erts/emulator/beam/dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -5589,6 +5589,9 @@ int erts_auto_connect(DistEntry* dep, Process *proc, ErtsProcLocks proc_locks)
return 0;
}

if (proc == net_kernel)
nk_locks |= ERTS_PROC_LOCK_MAIN;

/*
* Send {auto_connect, Node, DHandle} to net_kernel
*/
Expand All @@ -5599,6 +5602,10 @@ int erts_auto_connect(DistEntry* dep, Process *proc, ErtsProcLocks proc_locks)
msg = TUPLE3(hp, am_auto_connect, dep->sysname, dhandle);
ERL_MESSAGE_TOKEN(mp) = am_undefined;
erts_queue_proc_message(proc, net_kernel, nk_locks, mp, msg);

if (proc == net_kernel)
nk_locks &= ~ERTS_PROC_LOCK_MAIN;

erts_proc_unlock(net_kernel, nk_locks);
}

Expand Down

0 comments on commit 3896876

Please sign in to comment.