Unexpected behaviour of net_kernel
Wed Sep 1 13:00:00 CEST 2021
I am a beginner in Erlang and I'm working on a project.
I am working with nodes that need to connect and disconnect frequently both
in "visible" and "hidden" mode.
I wonder if there is a bug in net_kernel, because I observe the following
unexpected behaviour and I'm unable to link it to any action caused by my
What happens in the execution of my program is roughly the following:
initial state: node A is connected (in visible mode) to node B,
node D is not connected to any other node
1) node A disconnects from B (using net_kernel:disconnect/1)
2) node A connects to node D (using net_kernel:connect_node/1)
result: somehow D receives nodeup messages and connects to both A and B
expected behaviour: node D should connect to just A, while B should be
connected to no one
Note that steps 1 and 2 are executed sequentially in the same function so
there's no way they could be concurrent.
Could this be a bug in net_kernel?
I thought that maybe, somehow A has some messages related to net_kernel
that hang up in a way such that when step 2 happens, node A is not yet
disconnected completely from B?
Is it possible that something like that happens? If yes, how can I avoid
Even if I'm pretty confident that my code works as intended and I tried to
debug and check it several times, of course the other option is that this
could be caused by a bug in my code.
Of course there are a lot of other processes involved that I can't explain
here, but let's suppose that they don't cause any interference with the
I hope someone who knows Erlang better than me can help me clarify my
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions