Open hansongChina opened 2 years ago
Hi @ikaven1024, can you help take a look?
/assign
The root cause is response objects are shared in cache. https://github.com/karmada-io/karmada/pull/2483 will deep copy objects from cache, this may help. @hansongChina you can pick this PR and retry.
@ikaven1024, maybe we need to cherry-pick #2483 to branch release1.3.
@ikaven1024, maybe we need to cherry-pick #2483 to branch release1.3.
Agree, I will do it.
Agree, I will do it.
Thanks! You can cherry-pick refer to https://karmada.io/docs/contributor/cherry-picks.
I've done that in the list get Watch method deep copy objects, Can't seem to solve the problem。 @ikaven1024
I've done that in the list get Watch method deep copy objects, Can't seem to solve the problem。 @ikaven1024
Hi @hansongChina, do you mean you've cherry-picked the related code before you run into this problem?
Karmada version: 1.3
Are you using v1.3.0?
Karmada version: 1.3
Are you using v1.3.0?
yes !
I've done that in the list get Watch method deep copy objects, Can't seem to solve the problem。 @ikaven1024
Hi @hansongChina, do you mean you've cherry-picked the related code before you run into this problem?
We added,not cherry-picked the related code, not deep copy can cause an invalid resource version bug。
not deep copy can cause an invalid resource version bug。
Do you mean updating object cause invalid resource version
bug? This is fixed in https://github.com/karmada-io/karmada/pull/2469
https://github.com/karmada-io/karmada/blob/a7a944a1a5a7de07291363ead0f1a0015819c4bd/pkg/search/proxy/cluster_proxy.go#L116
@hansongChina could you show your modifications?
not deep copy can cause an invalid resource version bug。
Do you mean updating object cause
invalid resource version
bug? This is fixed in #2469
yes This is also a bug ,but this not updating, get method, If you don't add deep copy ,Using the same pointer in cache and changing the annotation value will affect cache。
The code you show is watch
method. Objects in event are deep copied in https://github.com/karmada-io/karmada/blob/614e28508336d6c03a938ce1bf0678dafef034f0/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go#L1289-L1303.
For get
method, object is deep copied: https://github.com/karmada-io/karmada/blob/21282fd1832b225892130654c4715de452de3e28/pkg/search/proxy/store/multi_cluster_cache.go#L139-L150
If you don't add deep copy ,Using the same pointer in cache and changing the annotation value will affect cache。
Could you describe how to trigger this matter?
Ok, I got it. I'll be running around watching your code when it merges into the 1.3.0 BRANCH
@hansongChina could you show the running goroutines below the panic in log. I want to know who is writing the map.
Ok, I got it. I'll be running around watching your code when it merges into the 1.3.0 BRANCH
Sorry i forgot to tell you these commits had been merged into 1.3.0 branch.
Hi @hansongChina, How's it going? Do you have any problems using version 1.3?
What happened: fatal error: concurrent map iteration and map write
What you expected to happen: Running normally
How to reproduce it (as minimally and precisely as possible): Run 24 hours to find once, do not know how to reproduce Below is the detailed error message
/root/workspace/karmada/vendor/k8s.io/apiserver/pkg/server/filters/timeout.go:100 +0x1dd created by k8s.io/apiserver/pkg/server/filters.(timeoutHandler).ServeHTTP /root/go/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0654d7fe8 sp=0xc0654d7fe0 pc=0x46ad01 runtime.goexit() /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/server/filters/timeout.go:114 +0x70 fp=0xc0654d7fe0 sp=0xc0654d7f90 pc=0x18ebad0 k8s.io/apiserver/pkg/server/filters.(timeoutHandler).ServeHTTP.func1() /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7f90 sp=0xc0654d7f68 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0xc01a45ea80, {0x2796f98, 0xc064e9b4c0}, 0x8e56b2) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:89 +0x46b fp=0xc0654d7f68 sp=0xc0654d7ea0 pc=0x170a78b k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5200) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7ea0 sp=0xc0654d7e78 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x279ebc0, {0x2796f98, 0xc064e9b4c0}, 0x2745430) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go:80 +0x839 fp=0xc0654d7e78 sp=0xc0654d7c58 pc=0x1712d19 k8s.io/apiserver/pkg/endpoints/filters.withAuthentication.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7c58 sp=0xc0654d7c30 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x279ebf8, {0x2796f98, 0xc064e9b4c0}, 0x2509ea8) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:104 +0x1a5 fp=0xc0654d7c30 sp=0xc0654d7b70 pc=0x170aaa5 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:98 +0x37 fp=0xc0654d7b70 sp=0xc0654d7b40 pc=0x170ab37 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1·dwrap·1() /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7b40 sp=0xc0654d7b18 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0xc064ecc630, {0x2796f98, 0xc064e9b4c0}, 0x99bb6a) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:80 +0x178 fp=0xc0654d7b18 sp=0xc0654d7a50 pc=0x170a498 k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7a50 sp=0xc0654d7a28 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x3be3930, {0x2796f98, 0xc064e9b4c0}, 0xa) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:104 +0x1a5 fp=0xc0654d7a28 sp=0xc0654d7968 pc=0x170aaa5 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:98 +0x37 fp=0xc0654d7968 sp=0xc0654d7938 pc=0x170ab37 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1·dwrap·1() /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7938 sp=0xc0654d7910 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0xc064ecc630, {0x2796f98, 0xc064e9b4c0}, 0x99bb6a) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:80 +0x178 fp=0xc0654d7910 sp=0xc0654d7848 pc=0x170a498 k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7848 sp=0xc0654d7820 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x3be3930, {0x2796f98, 0xc064e9b4c0}, 0xa) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go:50 +0x21c fp=0xc0654d7820 sp=0xc0654d7190 pc=0x1714ddc k8s.io/apiserver/pkg/endpoints/filters.WithImpersonation.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7190 sp=0xc0654d7168 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x1, {0x2796f98, 0xc064e9b4c0}, 0xc0638d7220) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:104 +0x1a5 fp=0xc0654d7168 sp=0xc0654d70a8 pc=0x170aaa5 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:98 +0x37 fp=0xc0654d70a8 sp=0xc0654d7078 pc=0x170ab37 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1·dwrap·1() /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d7078 sp=0xc0654d7050 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0xc064ecc630, {0x2796f98, 0xc064e9b4c0}, 0x99bb6a) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/server/filters/maxinflight.go:187 +0x26b fp=0xc0654d7050 sp=0xc0654d6fa8 pc=0x18e896b k8s.io/apiserver/pkg/server/filters.WithMaxInFlightLimit.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d6fa8 sp=0xc0654d6f80 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x3b918e0, {0x2796f98, 0xc064e9b4c0}, 0x3) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:80 +0x178 fp=0xc0654d6f80 sp=0xc0654d6eb8 pc=0x170a498 k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d6eb8 sp=0xc0654d6e90 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x3be3930, {0x2796f98, 0xc064e9b4c0}, 0x3f647ae147ae147b) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filters/authorization.go:64 +0x4d0 fp=0xc0654d6e90 sp=0xc0654d6d60 pc=0x1714590 k8s.io/apiserver/pkg/endpoints/filters.WithAuthorization.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/go/go/src/net/http/server.go:2047 +0x2f fp=0xc0654d6d60 sp=0xc0654d6d38 pc=0x6aff6f net/http.HandlerFunc.ServeHTTP(0x279ebf8, {0x2796f98, 0xc064e9b4c0}, 0x4) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:104 +0x1a5 fp=0xc0654d6d38 sp=0xc0654d6c78 pc=0x170aaa5 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1({0x2796f98, 0xc064e9b4c0}, 0xc064ec5400) /root/workspace/karmada/vendor/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:98 +0x37 fp=0xc0654d6c78 sp=0xc0654d6c48 pc=0x170ab37 k8s.io/apiserver/pkg/endpoints/filterlatency.trackCompleted.func1·dwrap·1()