Closed sammy007 closed 4 years ago
Hmm, that doesn't sound right as it should attempt to dial the address provided (https://github.com/liftbridge-io/go-liftbridge/blob/master/client.go#L235). Will take a look...
I incorrectly reported the issue, but it's still there:
package main
import (
"fmt"
"context"
lift "github.com/liftbridge-io/go-liftbridge"
proto "github.com/liftbridge-io/liftbridge-api/go"
)
func main() {
addrs := []string{"some.node:9292"}
client, err := lift.Connect(addrs)
if err != nil {
panic(err)
}
defer client.Close()
ctx := context.Background()
if err := client.Subscribe(ctx, "foo-stream", func(msg *proto.Message, err error) {
if err != nil {
panic(err)
}
fmt.Println(msg.Offset, string(msg.Value))
}, lift.StartAtEarliestReceived()); err != nil {
panic(err) # !!! PANICS HERE.
}
<-ctx.Done()
}
panic: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp [::1]:9292: connect: connection refused"
goroutine 1 [running]:
main.main()
/Users/me/code/toys/lb.go:27
It panics after Subscribe
. Of course if wrong port/host specified it panics right after connect.
Well, the issue is that if I set listen: 0.0.0.0:9292
in config and connect to it from outside client will try to use 0.0.0.0
and panics because obviously I have nothing listening on that port on client machine. If I set external instead of 0.0.0.0
client can perform Subscribe
. So when setting up cluster need to keep that in mind and explicitly specify external IPs and never use that 0.0.0.0
trick or localhost for some nodes. Not sure that is right behaviour though.
Okay, must set host
and port
in config.
Yeah this should probably be better documented in the config documentation. Sorry you hit this.
On Mon, Dec 2, 2019, 9:36 PM Sammy Libre notifications@github.com wrote:
Closed #33 https://github.com/liftbridge-io/go-liftbridge/issues/33.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/liftbridge-io/go-liftbridge/issues/33?email_source=notifications&email_token=AAEG64ISM42DABUJXVNI67DQWXH5VA5CNFSM4JUJFUL2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOVHDTVZY#event-2848406247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEG64MCJ4FQJHUGT6DCN4TQWXH5VANCNFSM4JUJFULQ .
Looks like client ignores host setting.