radondb / xenon

The MySQL Cluster Autopilot Management with GTID and Raft
GNU General Public License v3.0
693 stars 162 forks source link

[bug] `rsp` still calls after `get client` failure. #158

Closed runkecheng closed 2 years ago

runkecheng commented 2 years ago

https://github.com/radondb/xenon/blob/master/src/ctl/v1/xenon.go#L37

  2022/03/29 11:08:07.625674 xenon.go:34:        [ERROR]    api.v1.xenon.ping.error:get.client.error[dial tcp: i/o timeout]

 2022/03/29 11:08:07 http: panic serving 10.10.242.157:41652: runtime error: invalid memory address or nil pointer dereference

 goroutine 65 [running]:

 net/http.(*conn).serve.func1(0xc0002ea0a0)

    /usr/local/go/src/net/http/server.go:1804 +0x153

 panic(0x87e1a0, 0xbefaf0)

    /usr/local/go/src/runtime/panic.go:971 +0x499

 ctl/v1.xenonPingHandler(0xc000186330, 0xc00016cb40, 0x993a80, 0xc00038d230, 0xc00038d218)

    /go/src/github.com/radondb/xenon/src/ctl/v1/xenon.go:37 +0x11c

 ctl/v1.XenonPingHandler.func1(0x993a80, 0xc00038d230, 0xc00038d218)

    /go/src/github.com/radondb/xenon/src/ctl/v1/xenon.go:25 +0x51

 vendor/github.com/ant0ine/go-json-rest/rest.(*router).AppFunc.func1(0x993a80, 0xc00038d230, 0xc00038d218)

    /go/src/github.com/radondb/xenon/src/vendor/github.com/ant0ine/go-json-rest/rest/router.go:56 +0x99

 vendor/github.com/ant0ine/go-json-rest/rest.(*AuthBasicMiddleware).MiddlewareFunc.func2(0x993a80, 0xc00038d230, 0xc00038d218)

    /go/src/github.com/radondb/xenon/src/vendor/github.com/ant0ine/go-json-rest/rest/auth_basic.go:73 +0x1cf

 vendor/github.com/ant0ine/go-json-rest/rest.adapterFunc.func1(0x992c88, 0xc000184380, 0xc000422100)

    /go/src/github.com/radondb/xenon/src/vendor/github.com/ant0ine/go-json-rest/rest/middleware.go:70 +0xd3

 net/http.HandlerFunc.ServeHTTP(0xc000094460, 0x992c88, 0xc000184380, 0xc000422100)

    /usr/local/go/src/net/http/server.go:2049 +0x44

 net/http.serverHandler.ServeHTTP(0xc000304000, 0x992c88, 0xc000184380, 0xc000422100)

    /usr/local/go/src/net/http/server.go:2867 +0xa3

 net/http.(*conn).serve(0xc0002ea0a0, 0x9937e0, 0xc0002de9c0)

    /usr/local/go/src/net/http/server.go:1932 +0x8cd

 created by net/http.(*Server).Serve

    /usr/local/go/src/net/http/server.go:2993 +0x39b
andyli029 commented 2 years ago

ACK.