-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
A field in a structure is sometimes protected by Mutex, but sometimes unprotected. #7222
Comments
The only way to properly protect |
Only if it's read/write from multiple go routines at the same time.
Also, note that we have a fair amount of tests that run this code successfully with the |
What version of Hugo are you using (
hugo version
)?master branch, commit c03ea2b
What happened:
A field in a structure is sometimes protected by Mutex, but sometimes unprotected.
This may lead to data race.
There are 2 such cases:
templateStateMap.templates
is not protected byt.mu
on L754. But for all the other 3 places, it is protected byt.mu
.hugo/tpl/tplimpl/template.go
Lines 722 to 723 in c03ea2b
t.text
is not protected byt.nameSpace.mu
on L35. But for all the other 3 places (https://github.com/gohugoio/hugo/blob/master/tpl/internal/go_templates/htmltemplate/template.go), it is protected byt.nameSpace.mu
.hugo/tpl/internal/go_templates/htmltemplate/hugo_template.go
Lines 31 to 35 in c03ea2b
What you expected to happen:
Data race
The text was updated successfully, but these errors were encountered: