arana-db / arana

Arana is a Cloud Native Database Proxy. It can also be deployed as a Database mesh sidecar.
http://arana-docs.rtfd.io/
Apache License 2.0
292 stars 92 forks source link

[Bug] when use `nacos` as config center, arana start failure. #490

Closed dongzl closed 1 year ago

dongzl commented 2 years ago

What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

GOROOT=/usr/local/go #gosetup
GOPATH=/Users/dongzonglei/go #gosetup
/usr/local/go/bin/go build -o /private/var/folders/qg/zk85p89j08n0h8dk0yg56l580000gp/T/GoLand/___1START github.com/arana-db/arana/cmd #gosetup
/private/var/folders/qg/zk85p89j08n0h8dk0yg56l580000gp/T/GoLand/___1START start -c ./conf/bootstrap.yaml
2022-11-05T20:02:29.414+0800    DEBUG   proto/function.go:37    register mysql function ABS ok
2022-11-05T20:02:29.415+0800    DEBUG   proto/function.go:37    register mysql function CEIL ok
2022-11-05T20:02:29.415+0800    DEBUG   proto/function.go:37    register mysql function CONCAT ok
2022-11-05T20:02:29.415+0800    DEBUG   proto/function.go:37    register mysql function FLOOR ok
2022-11-05T20:02:29.415+0800    DEBUG   proto/function.go:37    register mysql function MOD ok

   ___   ___  ___   _  _____
  / _ | / _ \/ _ | / |/ / _ |
 / __ |/ , _/ __ |/    / __ |
/_/ |_/_/|_/_/ |_/_/|_/_/ |_|
Arana, A High performance & Powerful DB Mesh sidecar.
_____________________________________________

2022/11/05 20:02:29 [INFO] logDir:</private/var/folders/qg/zk85p89j08n0h8dk0yg56l580000gp/T/GoLand/log>   cacheDir:</private/var/folders/qg/zk85p89j08n0h8dk0yg56l580000gp/T/GoLand/cache>
2022-11-05T20:02:29.490+0800    INFO    config/default.go:53    [StoreOperate] use plugin : nacos
2022-11-05T20:02:29.490+0800    INFO    rpc/rpc_client.go:276   config-0-9b9ebf04-e5c6-4cb7-8ccb-448271090ed9 register server push request:ConfigChangeNotifyRequest handler%!(EXTRA *config_client.ConfigChangeNotifyRequestHandler=&{0xc0002b9c20})
2022-11-05T20:02:29.491+0800    INFO    rpc/rpc_client.go:276   config-0-9b9ebf04-e5c6-4cb7-8ccb-448271090ed9 register server push request:ConnectResetRequest handler%!(EXTRA *rpc.ConnectResetRequestHandler=&{})
2022-11-05T20:02:29.491+0800    INFO    rpc/rpc_client.go:276   config-0-9b9ebf04-e5c6-4cb7-8ccb-448271090ed9 register server push request:ClientDetectionRequest handler%!(EXTRA *rpc.ClientDetectionRequestHandler=&{})
2022-11-05T20:02:29.491+0800    INFO    rpc/rpc_client.go:214   [RpcClient.Start] config-0-9b9ebf04-e5c6-4cb7-8ccb-448271090ed9 try to connect to server on start up, server: {serverIp:127.0.0.1 serverPort:8848}
2022-11-05T20:02:29.491+0800    INFO    util/common.go:96       Local IP:0.0.1.1
2022-11-05T20:02:29.594+0800    INFO    rpc/rpc_client.go:224   config-0-9b9ebf04-e5c6-4cb7-8ccb-448271090ed9 success to connect to server {serverIp:127.0.0.1 serverPort:8848} on start up, connectionId=1667649749493_127.0.0.1_63862
2022-11-05T20:02:31.502+0800    INFO    namespace/command.go:215        [employees] upsert db employees_0000.node0 successfully
2022-11-05T20:02:31.503+0800    INFO    namespace/command.go:215        [employees] upsert db employees_0001.node1 successfully
2022-11-05T20:02:31.503+0800    INFO    namespace/command.go:215        [employees] upsert db employees_0002.node2 successfully
2022-11-05T20:02:31.503+0800    INFO    namespace/command.go:215        [employees] upsert db employees_0003.node3 successfully
2022-11-05T20:02:31.503+0800    INFO    namespace/command.go:228        [employees] update rule successfully
2022-11-05T20:02:31.503+0800    INFO    boot/boot.go:126        [arana] register namespace employees ok
2022-11-05T20:02:31.503+0800    INFO    boot/boot.go:135        [arana] register user 'root' ok
2022-11-05T20:02:31.503+0800    INFO    boot/boot.go:135        [arana] register user 'arana' ok
2022-11-05T20:02:31.503+0800    INFO    boot/boot.go:143        [arana] boot successfully after 1901ms
2022-11-05T20:02:31.503+0800    INFO    boot/boot.go:94 [arana] start watching changes
2022-11-05T20:02:31.503+0800    INFO    mysql/server.go:134     start mysql Listener [::]:13306
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x15b1fbf]

goroutine 95 [running]:
github.com/arana-db/arana/pkg/config.NewConfigWatcher.func1({0xc000448460, 0x20}, {0xc000932dc8, 0x5, 0x8})
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:82 +0x4bf
github.com/arana-db/arana/pkg/config.(*configWatcher).watchKey(0x0?, {0x2328208, 0xc00048fc80}, {0xc000448460, 0x20}, 0xc0004e4de0, 0xc000486e90)
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:145 +0x68
created by github.com/arana-db/arana/pkg/config.(*configWatcher).watchFromStore
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:131 +0xc7
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x15b1fbf]

goroutine 88 [running]:
github.com/arana-db/arana/pkg/config.NewConfigWatcher.func1({0xc000448200, 0x20}, {0xc000932dc8, 0x5, 0x8})
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:82 +0x4bf
github.com/arana-db/arana/pkg/config.(*configWatcher).watchKey(0x0?, {0x2328208, 0xc00048f880}, {0xc000448200, 0x20}, 0xc0004e4720, 0xc0004867a0)
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:145 +0x68
created by github.com/arana-db/arana/pkg/config.(*configWatcher).watchFromStore
        /Users/dongzonglei/source_code/Github/arana/pkg/config/config_watcher.go:131 +0xc7

Process finished with the exit code 2
PangXing commented 2 years ago

Please assign to me.

PangXing commented 1 year ago

This core is because of Pathkey DefaultConfigSpecPath doesn't have watch Event. image