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

Got fatal error: concurrent map writes when make run. #202

Closed
wangcanfengxs opened this issue Nov 23, 2020 · 3 comments
Closed

Got fatal error: concurrent map writes when make run. #202

wangcanfengxs opened this issue Nov 23, 2020 · 3 comments
Assignees
Labels
area/reconciler kind/bug Something isn't working reconciler/harbor-cluster release/1.0 Issues for the release 1.0

Comments

@wangcanfengxs
Copy link
Collaborator

wangcanfengxs commented Nov 23, 2020

log:
image

@wangcanfengxs wangcanfengxs changed the title Got concurrent write map error when make run Got fatal error: concurrent map writes when make run. Nov 23, 2020
@steven-zou steven-zou added kind/bug Something isn't working release/1.0 Issues for the release 1.0 labels Nov 24, 2020
@steven-zou
Copy link
Collaborator

It seems the webhook registration does not support the concurrent register approach.

// Register marks the given webhook as being served at the given path.
// It panics if two hooks are registered on the same path.
func (s *Server) Register(path string, hook http.Handler) {
	s.defaultingOnce.Do(s.setDefaults)
	_, found := s.webhooks[path]
	if found {
		panic(fmt.Errorf("can't register duplicate path: %v", path))
	}
	// TODO(directxman12): call setfields if we've already started the server
	s.webhooks[path] = hook
	s.WebhookMux.Handle(path, instrumentedHook(path, hook))
	log.Info("registering webhook", "path", path)
}

panic here s.webhooks[path] = hook

the webhooks is just a common map:

// webhooks keep track of all registered webhooks for dependency injection,
	// and to provide better panic messages on duplicate webhook registration.
	webhooks map[string]http.Handler

@steven-zou
Copy link
Collaborator

Create an issue to the controller-runtime lib, check kubernetes-sigs/controller-runtime#1285

steven-zou added a commit to steven-zou/harbor-operator that referenced this issue Dec 3, 2020
- remove errorgroup in the `WebhooksWithManager` func

fix goharbor#202

Signed-off-by: Steven Zou <szou@vmware.com>
@steven-zou
Copy link
Collaborator

They fixed it in kubernetes-sigs/controller-runtime#1225 and fix contained in V0.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/reconciler kind/bug Something isn't working reconciler/harbor-cluster release/1.0 Issues for the release 1.0
Projects
None yet
Development

No branches or pull requests

2 participants