Skip to content

使用北极星作为服务发现时,在注册多个grpc client时,启动报错:concurrent map iteration and map write #3361

@JackChanw

Description

@JackChanw

What happened:

INFO msg=watcher's ctx cancel : context canceled
INFO msg=[resolver] update instances: [{"id":"7e55bf0237ad7a213c338824f08a89552fa2a1fb","name":"bv_media_server.grpc","version":"","metadata":{"env":"prod","env_id":"0","env_name":"","env_tag":"","protocol":"grpc","version":"","weight":"100"},"endpoints":["grpc://golden-us04.domob.cn:9789"]},{"id":"d742c26c247bbc377f8a99ac9c10e402f04da209","name":"bv_media_server.grpc","version":"","metadata":{"env":"prod","env_id":"0","env_name":"","env_tag":"","protocol":"grpc","version":"","weight":"100"},"endpoints":["grpc://golden-us03.domob.cn:9789"]}]
INFO msg=[resolver] update instances: [{"id":"7e55bf0237ad7a213c338824f08a89552fa2a1fb","name":"bv_media_server.grpc","version":"","metadata":{"env":"prod","env_id":"0","env_name":"","env_tag":"","protocol":"grpc","version":"","weight":"100"},"endpoints":["grpc://golden-us04.domob.cn:9789"]},{"id":"d742c26c247bbc377f8a99ac9c10e402f04da209","name":"bv_media_server.grpc","version":"","metadata":{"env":"prod","env_id":"0","env_name":"","env_tag":"","protocol":"grpc","version":"","weight":"100"},"endpoints":["grpc://golden-us03.domob.cn:9789"]}]
fatal error: concurrent map iteration and map write

What you expected to happen:

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

Anything else we need to know?:

goroutine 170 [running]:
github.com/go-kratos/kratos/v2/registry.(*ServiceInstance).Equal(0xc00089f630, {0x1636220?, 0xc00089f630})
/home/gitlab-runner/go/pkg/mod/github.com/go-kratos/kratos/v2@v2.7.3/registry/registry.go:88 +0x225
google.golang.org/grpc/attributes.(*Attributes).Equal(0x16092a0?, 0xc00067c260)
/home/gitlab-runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/attributes/attributes.go:96 +0x1b1
google.golang.org/grpc/resolver.addressMapEntryList.find(...)
/home/gitlab-runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/resolver/map.go:64
google.golang.org/grpc/resolver.(*AddressMap).Get(0xc000b5d9d8?, {{0xc000028047, 0x19}, {0xc00067a138, 0x12}, 0xc00067c260, 0x0, {0x0, 0x0}})
/home/gitlab-runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/resolver/map.go:75 +0x185
google.golang.org/grpc/balancer/base.(*baseBalancer).UpdateClientConnState(0xc000c91f00, {{{0xc000c91e80, 0x2, 0x2}, {0xc00093e9c0, 0x2, 0x2}, 0x0, 0x0}, {0x0, ...}})
/home/gitlab-runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/balancer/base/balancer.go:125 +0x4a5
google.golang.org/grpc/internal/balancer/gracefulswitch.(*Balancer).UpdateClientConnState(0xffffffffffffffff?, {{{0xc000c91e80, 0x2

Environment:

  • Kratos version (use kratos -v):
  • Go version (use go version):
  • OS (e.g: cat /etc/os-release):
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions