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

Data race in Go templates #917

Closed
bep opened this Issue Feb 20, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@bep
Member

bep commented Feb 20, 2015

Build Hugo with go build -race

And build a site.

Extract:

=================
==================
WARNING: DATA RACE
Read by goroutine 64:
  github.com/spf13/hugo/target.(*HTMLRedirectAlias).Translate()
      /home/bep/dev/go/src/github.com/spf13/hugo/target/htmlredirect.go:44 +0x1f1
  github.com/spf13/hugo/target.(*HTMLRedirectAlias).Publish()
      /home/bep/dev/go/src/github.com/spf13/hugo/target/htmlredirect.go:52 +0x75
  github.com/spf13/hugo/hugolib.(*Site).WriteDestAlias()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1514 +0x240
  github.com/spf13/hugo/hugolib.taxonomyRenderer()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1074 +0x786

Previous write by goroutine 54:
  github.com/spf13/hugo/hugolib.(*Site).AliasTarget()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1495 +0xb1
  github.com/spf13/hugo/hugolib.(*Site).WriteDestAlias()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1514 +0x1ee
  github.com/spf13/hugo/hugolib.taxonomyRenderer()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1074 +0x786

Goroutine 64 (running) created at:
  github.com/spf13/hugo/hugolib.(*Site).RenderTaxonomiesLists()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1010 +0x154
  github.com/spf13/hugo/hugolib.(*Site).Render()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:380 +0x9a
  github.com/spf13/hugo/hugolib.(*Site).Build()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:243 +0x99
  github.com/spf13/hugo/commands.buildSite()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:343 +0x136
  github.com/spf13/hugo/commands.build()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:255 +0x364
  github.com/spf13/hugo/commands.func·006()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:51 +0x4c
  github.com/spf13/cobra.(*Command).execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:355 +0x242
  github.com/spf13/cobra.(*Command).Execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:403 +0x224
  github.com/spf13/hugo/commands.Execute()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:64 +0x4c
  main.main()
      /home/bep/dev/go/src/github.com/spf13/hugo/main.go:24 +0x4c

Goroutine 54 (running) created at:
  github.com/spf13/hugo/hugolib.(*Site).RenderTaxonomiesLists()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1010 +0x154
  github.com/spf13/hugo/hugolib.(*Site).Render()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:380 +0x9a
  github.com/spf13/hugo/hugolib.(*Site).Build()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:243 +0x99
  github.com/spf13/hugo/commands.buildSite()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:343 +0x136
  github.com/spf13/hugo/commands.build()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:255 +0x364
  github.com/spf13/hugo/commands.func·006()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:51 +0x4c
  github.com/spf13/cobra.(*Command).execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:355 +0x242
  github.com/spf13/cobra.(*Command).Execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:403 +0x224
  github.com/spf13/hugo/commands.Execute()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:64 +0x4c
  main.main()
      /home/bep/dev/go/src/github.com/spf13/hugo/main.go:24 +0x4c
==================
==================
WARNING: DATA RACE
Read by goroutine 64:
  github.com/spf13/hugo/target.(*HTMLRedirectAlias).Publish()
      /home/bep/dev/go/src/github.com/spf13/hugo/target/htmlredirect.go:62 +0x1ca
  github.com/spf13/hugo/hugolib.(*Site).WriteDestAlias()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1514 +0x240
  github.com/spf13/hugo/hugolib.taxonomyRenderer()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1074 +0x786

Previous write by goroutine 54:
  github.com/spf13/hugo/hugolib.(*Site).AliasTarget()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1495 +0xb1
  github.com/spf13/hugo/hugolib.(*Site).WriteDestAlias()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1514 +0x1ee
  github.com/spf13/hugo/hugolib.taxonomyRenderer()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1074 +0x786

Goroutine 64 (running) created at:
  github.com/spf13/hugo/hugolib.(*Site).RenderTaxonomiesLists()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1010 +0x154
  github.com/spf13/hugo/hugolib.(*Site).Render()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:380 +0x9a
  github.com/spf13/hugo/hugolib.(*Site).Build()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:243 +0x99
  github.com/spf13/hugo/commands.buildSite()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:343 +0x136
  github.com/spf13/hugo/commands.build()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:255 +0x364
  github.com/spf13/hugo/commands.func·006()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:51 +0x4c
  github.com/spf13/cobra.(*Command).execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:355 +0x242
  github.com/spf13/cobra.(*Command).Execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:403 +0x224
  github.com/spf13/hugo/commands.Execute()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:64 +0x4c
  main.main()
      /home/bep/dev/go/src/github.com/spf13/hugo/main.go:24 +0x4c

Goroutine 54 (running) created at:
  github.com/spf13/hugo/hugolib.(*Site).RenderTaxonomiesLists()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:1010 +0x154
  github.com/spf13/hugo/hugolib.(*Site).Render()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:380 +0x9a
  github.com/spf13/hugo/hugolib.(*Site).Build()
      /home/bep/dev/go/src/github.com/spf13/hugo/hugolib/site.go:243 +0x99
  github.com/spf13/hugo/commands.buildSite()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:343 +0x136
  github.com/spf13/hugo/commands.build()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:255 +0x364
  github.com/spf13/hugo/commands.func·006()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:51 +0x4c
  github.com/spf13/cobra.(*Command).execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:355 +0x242
  github.com/spf13/cobra.(*Command).Execute()
      /home/bep/dev/go/src/github.com/spf13/cobra/command.go:403 +0x224
  github.com/spf13/hugo/commands.Execute()
      /home/bep/dev/go/src/github.com/spf13/hugo/commands/hugo.go:64 +0x4c
  main.main()
      /home/bep/dev/go/src/github.com/spf13/hugo/main.go:24 +0x4c
==================

@bep bep added the Bug label Feb 20, 2015

@bep bep self-assigned this Feb 20, 2015

bep added a commit that referenced this issue Feb 20, 2015

Avoid race condition in isInnerShortcode
As reported by Go's race detector.

See #917

bep added a commit that referenced this issue Feb 20, 2015

Avoid race condition in target list init
As reported by Go's race detector.

See #917
@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Feb 20, 2015

Member

One of the race issues seems to be a Go issue, see:

golang/go#9945

Member

bep commented Feb 20, 2015

One of the race issues seems to be a Go issue, see:

golang/go#9945

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Feb 20, 2015

Member

OK, that seems to be the last one. It's deep inside Go's templates, and is in heavy use in Hugo - but we'll have to wait until 1.5 for a fix.

Member

bep commented Feb 20, 2015

OK, that seems to be the last one. It's deep inside Go's templates, and is in heavy use in Hugo - but we'll have to wait until 1.5 for a fix.

@bep bep changed the title from Go race detector reports some errors to Data race in Go templates Feb 21, 2015

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep May 17, 2015

Member

golang/go#9945 is fixed - but it's still some months until Hugo can build with that version ...

Member

bep commented May 17, 2015

golang/go#9945 is fixed - but it's still some months until Hugo can build with that version ...

@kzys

This comment has been minimized.

Show comment
Hide comment
@kzys

kzys Oct 16, 2015

Contributor

I couldn't reproduce the issue with Go 1.5.1 (darwin/amd64) which includes golang/go#9945. Since the initial release of Go 1.5 is August, I think we can close the issue.

Contributor

kzys commented Oct 16, 2015

I couldn't reproduce the issue with Go 1.5.1 (darwin/amd64) which includes golang/go#9945. Since the initial release of Go 1.5 is August, I think we can close the issue.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Oct 16, 2015

Member

We will close this issue when Hugo 0.15 is released.

Member

bep commented Oct 16, 2015

We will close this issue when Hugo 0.15 is released.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Oct 20, 2015

Member

Never mind -- we're closing this now. That is in line with other bug fixes.

Member

bep commented Oct 20, 2015

Never mind -- we're closing this now. That is in line with other bug fixes.

@bep bep closed this Oct 20, 2015

tychoish added a commit to tychoish/hugo that referenced this issue Aug 13, 2017

Avoid race condition in isInnerShortcode
As reported by Go's race detector.

See #917

tychoish added a commit to tychoish/hugo that referenced this issue Aug 13, 2017

Avoid race condition in target list init
As reported by Go's race detector.

See #917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment