Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Panic Fix on concurrent read and write on map #178

Conversation

anirudhAgniRedhat
Copy link

@anirudhAgniRedhat anirudhAgniRedhat commented May 17, 2024

logs show fatal error: concurrent map read and map write

3. oc logs --previous cert-manager-b94b579f-m6j9v -n cert-manager > logs/cert-manager-b94b579f-m6j9v_previous.log
I1206 13:52:20.156106       1 controller.go:251] "cert-manager/controller/build-context: configured acme dns01 nameservers" nameservers=["172.30.0.10:53"]
W1206 13:52:20.156232       1 client_config.go:618] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I1206 13:52:20.157954       1 controller.go:145] "cert-manager/controller: starting leader election"
I1206 13:52:20.157980       1 controller.go:93] "cert-manager/controller: starting metrics server" address="[::]:9402"
I1206 13:52:20.158088       1 controller.go:138] "cert-manager/controller: starting healthz server" address="[::]:9403"
I1206 13:52:20.158571       1 leaderelection.go:250] attempting to acquire leader lease kube-system/cert-manager-controller...
I1206 13:52:20.177614       1 leaderelection.go:260] successfully acquired lease kube-system/cert-manager-controller
I1206 13:52:20.178751       1 controller.go:215] "cert-manager/controller: starting controller" controller="challenges"
I1206 13:52:20.179185       1 controller.go:215] "cert-manager/controller: starting controller" controller="certificaterequests-approver"
I1206 13:52:20.179380       1 controller.go:215] "cert-manager/controller: starting controller" controller="certificaterequests-issuer-ca"
I1206 13:52:20.179636       1 controller.go:215] "cert-manager/controller: starting controller" controller="certificates-metrics"
I1206 13:52:20.179909       1 controller.go:215] "cert-manager/controller: starting controller" controller="certificates-readiness"
I1206 13:52:20.180172       1 controller.go:215] "cert-manager/controller: starting controller" controller="certificates-revision-manager"
I1206 13:52:20.180277       1 controller.go:192] "cert-manager/controller: not starting controller as it's disabled" controller="gateway-shim"
I1206 13:52:20.180389       1 controller.go:215] "cert-manager/controller: starting controller" controller="issuers"
fatal error: concurrent map read and map write

goroutine 91 [running]:
k8s.io/apimachinery/pkg/runtime.(*Scheme).ObjectKinds(0xc0001c59d0, {0x2c883f0?, 0xc000b92140})
	/remote-source/app/cmd/controller/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go:267 +0x1ca
k8s.io/apimachinery/pkg/runtime.WithVersionEncoder.Encode({{0x2c8ed40, 0xc000342540}, {0x2c8a470, 0xc00013ce10}, {0x2c8a3d0, 0xc0001c59d0}}, {0x2c883f0, 0xc000b92140}, {0x2c79640, 0xc000ad16e0})
	/remote-source/app/cmd/controller/vendor/k8s.io/apimachinery/pkg/runtime/helper.go:223 +0x82
k8s.io/apimachinery/pkg/runtime.Encode({0x2c8ecc8, 0xc000ad16b0}, {0x2c883f0, 0xc000b92140})

Added mutex lock to remove concurrent read and writes.

#173

Signed-off-by: anirudhAgniRedhat <aagnihot@redhat.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 17, 2024
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anirudhAgniRedhat
Once this PR has been reviewed and has the lgtm label, please assign caesarxuchao for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label May 17, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 17, 2024
@@ -82,6 +83,9 @@ type Scheme struct {
// schemeName is the name of this scheme. If you don't specify a name, the stack of the NewScheme caller will be used.
// This is useful for error reporting to indicate the origin of the scheme.
schemeName string

// mutex is used to lock and unlock the maps used to avoid panics
mutex sync.RWMutex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this contradicts the intention of the Scheme type:

Schemes are not expected to change at runtime and are only threadsafe after
// registration is complete.

See above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants