Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

Bootstrap can occur without listen #275

Open
benfleis opened this issue May 25, 2016 · 0 comments
Open

Bootstrap can occur without listen #275

benfleis opened this issue May 25, 2016 · 0 comments

Comments

@benfleis
Copy link
Contributor

benfleis commented May 25, 2016

(More or less duplicate of uber/ringpop-go#146)

Ringpop currently allows bootstrap to occur without a listening tchannel underneath. This was confirmed by using tick-cluster with bootstrap but not listen on both a single node, and all nodes (patch below).

Behaviorally, a single node failing to listen is the worst case. It has continuous 1-way interactions with other nodes, and seems to create a continuous cycle of other nodes marking it suspect. This is possible in real life during a rolling upgrade, or if bootstrap/listen handling is incorrect in some cases.

If all nodes fail to listen, they all simply fail to bootstrap, as expected.

Our current code demonstrates listen() before bootstrap() pretty consistently, but given the failure modes, we ought to be more defensive and confirm that the tchannel is already listening, or call this.channel.listen() ourselves.

Behavior was confirmed by watching tick-cluster logs, and running ringpop-admin dump on one of the live nodes.


diff --git a/main.js b/main.js
index dc8fd2c..bd4f101 100755
--- a/main.js
+++ b/main.js
@@ -61,10 +61,15 @@ function main(args) {
     var listenParts = listen.split(':');
     var port = Number(listenParts[1]);
     var host = listenParts[0];
-    tchannel.listen(port, host, onListening);

-    function onListening() {
+    if (port === 3000) {
         ringpop.bootstrap(program.hosts);
+    } else {
+        tchannel.listen(port, host, onListening);
+
+        function onListening() {
+            ringpop.bootstrap(program.hosts);
+        }
     }
 }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant