Handling unexpected node exit and rejoin on different port

Posted in General by Douglas Vought Tue Dec 05 2017 10:53:01 GMT+0000 (UTC)·3·Viewed 359 times

I've been playing with lasp_pg from the Elixir terminal and noticed this behavior: I'm doing this from two elixir terminal sessions: Start node lasp1. Start node lasp2. Join to lasp1. Kill session (^C^C) Lasp1 says lasp2 is disconnected. Start node lasp2 again. Join to lasp1. Lasp1 now has two lasp2's in the membership list and continues to say that lasp2 is disconnected. I understand *why* it's doing this - the new lasp2 is connecting on a different port. The main issue is that, to stop the errors from coming in, I must force lasp2 to leave to clear out the previous lasp2 connection and then have lasp2 join again. Is there a way to force the lasp2's old connection to 'expire' based on its old port and remove it from the membership?
Christopher Meiklejohn
Dec 5, 2017

Leave is explicit, by design. This is because nodes may become disconnected and then re-connect.

To keep lasp2 with the same port, I would use the application config (sys.config, config.exs) to set the listen_addrs, so lasp2 doesn't use a random port, but uses the same port each time it starts.

Does that make sense?

Douglas Vought
Dec 5, 2017

Does that make sense?

Yes! Thanks for the response.

Christopher Meiklejohn marked this as solved
Markdown is allowed