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

Fix doSchema lock issue #403

Merged
merged 1 commit into from
Jan 7, 2022
Merged

Conversation

takmatsu
Copy link
Contributor

@takmatsu takmatsu commented Sep 22, 2021

Backgroud

We sometimes faced the panic fatal error: concurrent map read and map write or fatal error: concurrent map iteration and map write.

Investigation

we found the current lock is not enough:

	schemas, ok := s.schemasByPath[path]

this line seems wanted to copy but it's not copy because it's map.

and then, we have the possibility to face a panic like below

concurrent map read and map write :

	schema := schemas[name]

concurrent map iteration and map write :

	for _, check := range schemas {

What is this PR

This PR fixes the above issue by extending lock to the end of this function.

@dramich dramich removed their request for review October 22, 2021 20:50
@ibuildthecloud ibuildthecloud merged commit 4feb41e into rancher:master Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants