Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap can occur without listen #146

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

Bootstrap can occur without listen #146

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-node/ringpop-node#275)

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 r.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/scripts/testpop/testpop.go b/scripts/testpop/testpop.go
index a239893..d6a3d1b 100644
--- a/scripts/testpop/testpop.go
+++ b/scripts/testpop/testpop.go
@@ -66,16 +66,26 @@ func main() {
        ringpop.TombstonePeriod(5*time.Second),
    )

-   if err := ch.ListenAndServe(*hostport); err != nil {
-       log.Fatalf("could not listen on %s: %v", *hostport, err)
-   }
+   if *hostport == "172.18.24.59:3000" {
+       opts := &swim.BootstrapOptions{}
+       opts.DiscoverProvider = jsonfile.New(*hostfile)

-   opts := &swim.BootstrapOptions{}
-   opts.DiscoverProvider = jsonfile.New(*hostfile)
+       _, err = rp.Bootstrap(opts)
+       if err != nil {
+           log.Fatalf("bootstrap failed: %v", err)
+       }
+   } else {
+       if err := ch.ListenAndServe(*hostport); err != nil {
+           log.Fatalf("could not listen on %s: %v", *hostport, err)
+       }

-   _, err = rp.Bootstrap(opts)
-   if err != nil {
-       log.Fatalf("bootstrap failed: %v", err)
+       opts := &swim.BootstrapOptions{}
+       opts.DiscoverProvider = jsonfile.New(*hostfile)
+
+       _, err = rp.Bootstrap(opts)
+       if err != nil {
+           log.Fatalf("bootstrap failed: %v", err)
+       }
    }

    // block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant