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 data race in templating code #7507

Closed
wants to merge 1 commit into from

Conversation

andreasf
Copy link

This should fix the concurrent map access crashes reported in #7293.

Changes:

  • Use existing "muFunc" lock in Template.AddParseTree and Template.Lookup
  • Call Template.Lookup from outside instead of accessing map directly

The additional lock doesn't appear to impact performance noticeably.

This should fix the "concurrent map access" crashes reported in gohugoio#7293.

Changes:
* Use existing "muFunc" lock in Template.AddParseTree and Template.Lookup
* Call Template.Lookup from outside instead of accessing map directly

The additional lock doesn't appear to impact performance noticeably.
@bep
Copy link
Member

bep commented Jul 23, 2020

Thanks for this; but this needs to be fixed upstream (https://github.com/golang/go) -- we have a (hopefully) temporary fork with some controlled patches to the execution of templates, but I'm not opening up that fence to bug fixes in the parser etc., that I don't have any plans to maintain here.

@bep
Copy link
Member

bep commented Dec 2, 2020

Sorry for the delay on this. If this will not be fixed for Go 1.16 then we need to fix it on our side.

@andreasf
Copy link
Author

andreasf commented Dec 2, 2020

It's not your fault, I didn't have time in the past weeks to look further into the discussion on the Go side.

@jmooring
Copy link
Member

Superseded by 9650e56

@jmooring jmooring closed this Feb 19, 2022
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants