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

text/template: data race in funcs #9945

Closed
bep opened this issue Feb 20, 2015 · 2 comments
Closed

text/template: data race in funcs #9945

bep opened this issue Feb 20, 2015 · 2 comments
Milestone

Comments

@bep
Copy link
Contributor

bep commented Feb 20, 2015

As reported by Go's race detector when building Hugo (https://github.com/spf13/hugo) with go build -race and then using Hugo to build a site:

==================
WARNING: DATA RACE
Write by goroutine 56:
  runtime.mapassign1()
      /home/bep/.gvm/gos/go1.4.2/src/runtime/hashmap.go:383 +0x0
  text/template.addValueFuncs()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/funcs.go:68 +0x4bd
  text/template.(*Template).Funcs()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/template.go:148 +0x253
  html/template.(*escaper).commit()
      /home/bep/.gvm/gos/go1.4.2/src/html/template/escape.go:741 +0x121
  html/template.escapeTemplate()
      /home/bep/.gvm/gos/go1.4.2/src/html/template/escape.go:39 +0x630
  html/template.(*Template).escape()
      /home/bep/.gvm/gos/go1.4.2/src/html/template/template.go:59 +0x1b5
  html/template.(*Template).Execute()
      /home/bep/.gvm/gos/go1.4.2/src/html/template/template.go:75 +0x4d
  github.com/spf13/hugo/hugolib.ShortcodeRender()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/shortcode.go:486 +0xf8
  ...

Previous read by goroutine 58:
  runtime.mapaccess1_faststr()
      /home/bep/.gvm/gos/go1.4.2/src/runtime/hashmap_fast.go:179 +0x0
  text/template.findFunction()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/funcs.go:95 +0x109
  text/template.(*state).evalFunction()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:455 +0x183
  text/template.(*state).evalCommand()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:359 +0x29f
  text/template.(*state).evalPipeline()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:332 +0x207
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:167 +0x194
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:175 +0xa09
  text/template.(*state).walkIfOrWith()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:205 +0x36e
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:172 +0x75c
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:175 +0xa09
  text/template.(*state).walkIfOrWith()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:205 +0x36e
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:172 +0x75c
  text/template.(*state).walk()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:175 +0xa09
  text/template.(*Template).Execute()
      /home/bep/.gvm/gos/go1.4.2/src/text/template/exec.go:155 +0x61d
  html/template.(*Template).Execute()
      /home/bep/.gvm/gos/go1.4.2/src/html/template/template.go:78 +0xd1
 github.com/spf13/hugo/hugolib.ShortcodeRender()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/shortcode.go:486 +0xf8

I have tried my best to rule out the calling code as the source of this race.

@dvyukov
Copy link
Member

dvyukov commented Feb 20, 2015

@robpike

@dvyukov dvyukov added this to the Go1.5 milestone Feb 20, 2015
@rsc rsc removed the repo-main label Apr 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/10101 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants