[erlang-questions] Reconnect to nodes

Roberto Ostinelli roberto@REDACTED
Fri Apr 22 11:39:19 CEST 2016


Dear list,
A simple question: am I correct that, when a node is removed because of a
net split, you need to have your own application logic to reconnect to it,
and nothing in the VM will try doing that for you?

Let me show you an example. I have two nodes: 1@REDACTED and 2@REDACTED
that are connected to each other:

(1@REDACTED)1> nodes().
['2@REDACTED']

On node 2 I listen for nodedown events of node 1:

(2@REDACTED)1> monitor_node('1@REDACTED', true).
true

On node 1, I simulate a net splits with the best option I've found until
now, i.e suspending the net_kernel process:

(1@REDACTED)2> sys:suspend(net_kernel).
ok

After ~60 seconds on node 2 I get:

=ERROR REPORT==== 22-Apr-2016::11:28:21 ===
** Node '1@REDACTED' not responding **
** Removing (timedout) connection **
(2@REDACTED)2> flush().
Shell got {nodedown,'1@REDACTED'}

Now the two nodes are disconnected:

(1@REDACTED)3> nodes().
[]

(2@REDACTED)3> nodes().
[]

Even when I resume the net_kernel process:

(1@REDACTED)4> sys:resume(net_kernel).
ok

The nodes do not reconnect:

(1@REDACTED)5> nodes().
[]

I'm ok with this, though I would like to confirm that my understanding is
correct.
If so, does everyone just implement some standard connection manager that
does only reconnections?

Thank you,
r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160422/07c67340/attachment.htm>


More information about the erlang-questions mailing list