From 01b21fcbf2bad82b6bf39c971f0cf397659018a3 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Tue, 5 May 2015 13:45:30 -0700 Subject: [PATCH] Barak registration fix. Retries every hour now. --- NOTES | 16 ++++++++++++++++ cmd/barak/main.go | 16 ++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 NOTES diff --git a/NOTES b/NOTES new file mode 100644 index 00000000..0655193f --- /dev/null +++ b/NOTES @@ -0,0 +1,16 @@ +debugging this thing. +Why doesn't the network boot up quicker? +Why does the VI:0 Precommit for height 1 not come around after round 1 and before round 6? + [Vote VI:0 V:Precommit{1/0 4B634C4301EA#PartSet{T:1 67344F9BB237} 9974E3F32592}] + [Vote VI:0 V:Precommit{1/1 4B634C4301EA#PartSet{T:1 67344F9BB237} B600DBFA00B3}] + [Vote VI:0 V:Precommit{1/6 4B634C4301EA#PartSet{T:1 67344F9BB237} 2C51D4B6047C}] + +Yet blackshadow did send a Prevote for 1/2 to whiteferret... +DBUG[05-04|14:19:36] Send module=p2p channel=22 connection=MConn{162.243.85.60:52630} msg="[Vote VI:0 V:Prevote{1/2 4B634C4301EA#PartSet{T:1 67344F9BB237} 2CFCF951C4D9}]" + +Why did blackshadow not send Prevote{1/2} to any other peer? +Did whiteferret not broadcast the Prevote to anyone else? +What is the capacity of our buffers? (the defaultSendQueueCapcity for the VotesCh is 1. Oops) + +Blackshadow was locked, so it did: +INFO[05-04|14:19:36] Signed and added vote module=consensus height=1 round=2 vote="Prevote{1/2 4B634C4301EA#PartSet{T:1 67344F9BB237} 2CFCF951C4D9}" diff --git a/cmd/barak/main.go b/cmd/barak/main.go index 9f28de78..3e95fb8a 100644 --- a/cmd/barak/main.go +++ b/cmd/barak/main.go @@ -103,13 +103,17 @@ func main() { // Register this barak with central listener for _, registry := range barak.registries { go func(registry string) { - resp, err := http.Get(registry + "/register") - if err != nil { - fmt.Printf("Error registering to registry %v:\n %v\n", registry, err) + for { + resp, err := http.Get(registry + "/register") + if err != nil { + fmt.Printf("Error registering to registry %v:\n %v\n", registry, err) + time.Sleep(1 * time.Hour) + continue + } + body, _ := ioutil.ReadAll(resp.Body) + fmt.Printf("Successfully registered with registry %v\n %v\n", registry, string(body)) return } - body, _ := ioutil.ReadAll(resp.Body) - fmt.Printf("Successfully registered with registry %v\n %v\n", registry, string(body)) }(registry) } @@ -276,7 +280,7 @@ func ListProcesses() (*ResponseListProcesses, error) { // Another barak instance registering its external // address to a remote barak. func Register(w http.ResponseWriter, req *http.Request) { - registry, err := os.OpenFile(barak.rootDir+"/registry.log", os.O_RDWR|os.O_APPEND|os.O_CREATE, 0x600) + registry, err := os.OpenFile(barak.rootDir+"/registry.log", os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600) if err != nil { http.Error(w, "Could not open registry file. Please contact the administrator", 500) return