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

cmd/compile/internal/types: concurrent map read and map write while compiling #21352

Closed
martisch opened this issue Aug 8, 2017 · 9 comments
Closed

Comments

@martisch
Copy link
Contributor

martisch commented Aug 8, 2017

one builder failed with what it seems to be a map read / write race during compilation:
https://build.golang.org/log/95ffcbbfdfe3e328d735db12f2127b1dcf1ab17c

at tip 64bd2c4

While the read location seems clear the write location does not seem to be in the trace.
Flake or map in a bad state?

fatal error: concurrent map read and map write

goroutine 15 [running]:
runtime.throw(0x86b5b6e, 0x21)
	/tmp/workdir/go/src/runtime/panic.go:605 +0x7c fp=0x1a121d60 sp=0x1a121d54 pc=0x806f14c
runtime.mapaccess1_faststr(0x86632e0, 0x19866780, 0x86a9cda, 0xd, 0x1)
	/tmp/workdir/go/src/runtime/hashmap_fast.go:213 +0x345 fp=0x1a121d8c sp=0x1a121d60 pc=0x80523b5
cmd/compile/internal/types.(*Pkg).LookupOK(...)
	/tmp/workdir/go/src/cmd/compile/internal/types/pkg.go:85
cmd/compile/internal/types.(*Pkg).Lookup(...)
	/tmp/workdir/go/src/cmd/compile/internal/types/pkg.go:73
cmd/compile/internal/gc.Sysfunc(0x86a9cda, 0xd, 0x199af3b0)
	/tmp/workdir/go/src/cmd/compile/internal/gc/gen.go:15 +0x50 fp=0x1a121dc0 sp=0x1a121d8c pc=0x852b900
cmd/compile/internal/x86.ssaGenValue387(0x1a318120, 0x19efb398)
	/tmp/workdir/go/src/cmd/compile/internal/x86/387.go:123 +0x294 fp=0x1a121e30 sp=0x1a121dc0 pc=0x8625a84
cmd/compile/internal/gc.genssa(0x1a045e00, 0x1a3180f0)
	/tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:4444 +0x254 fp=0x1a121f90 sp=0x1a121e30 pc=0x85a38e4
cmd/compile/internal/gc.compileSSA(0x19ad4000, 0x3)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:242 +0x61 fp=0x1a121fcc sp=0x1a121f90 pc=0x8557e61
cmd/compile/internal/gc.compileFunctions.func2(0x19f55980, 0x19bef280, 0x3)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:289 +0x3b fp=0x1a121fe0 sp=0x1a121fcc pc=0x85f2dbb
runtime.goexit()
	/tmp/workdir/go/src/runtime/asm_386.s:1635 +0x1 fp=0x1a121fe4 sp=0x1a121fe0 pc=0x8095f41
created by cmd/compile/internal/gc.compileFunctions
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:287 +0xeb

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x19bef28c)
	/tmp/workdir/go/src/runtime/sema.go:56 +0x2e
sync.(*WaitGroup).Wait(0x19bef280)
	/tmp/workdir/go/src/sync/waitgroup.go:131 +0x7b
cmd/compile/internal/gc.compileFunctions()
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:299 +0x188
cmd/compile/internal/gc.Main(0x86c16a4)
	/tmp/workdir/go/src/cmd/compile/internal/gc/main.go:595 +0x2546
main.main()
	/tmp/workdir/go/src/cmd/compile/main.go:49 +0x7e

goroutine 14 [runnable]:
cmd/compile/internal/types.(*Sym).LinksymName(...)
	/tmp/workdir/go/src/cmd/compile/internal/types/sym.go:73
cmd/compile/internal/types.(*Sym).Linksym(0x1a0dd700, 0x1a0a4120)
	/tmp/workdir/go/src/cmd/compile/internal/types/sym.go:80 +0xb5
cmd/compile/internal/gc.AddrAuto(0x19966a30, 0x19ecd974)
	/tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:4752 +0x50
cmd/compile/internal/x86.ssaGenValue387(0x1a067fb0, 0x19ecd39c)
	/tmp/workdir/go/src/cmd/compile/internal/x86/387.go:255 +0xf9a
cmd/compile/internal/gc.genssa(0x1a0b5cc0, 0x1a067f80)
	/tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:4444 +0x254
cmd/compile/internal/gc.compileSSA(0x19ad41a0, 0x2)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:242 +0x61
cmd/compile/internal/gc.compileFunctions.func2(0x19f55980, 0x19bef280, 0x2)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:289 +0x3b
created by cmd/compile/internal/gc.compileFunctions
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:287 +0xeb

goroutine 12 [runnable]:
cmd/compile/internal/ssa.(*regAllocState).placeSpills(0x1a2ef110)
	/tmp/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:1666 +0x807
cmd/compile/internal/ssa.(*regAllocState).regalloc(0x1a2ef110, 0x1a05a320)
	/tmp/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:1517 +0x6ace
cmd/compile/internal/ssa.regalloc(0x1a05a320)
	/tmp/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:144 +0x4f
cmd/compile/internal/ssa.Compile(0x1a05a320)
	/tmp/workdir/go/src/cmd/compile/internal/ssa/compile.go:70 +0x244
cmd/compile/internal/gc.buildssa(0x19b969c0, 0x0, 0x0)
	/tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:212 +0xb0f
cmd/compile/internal/gc.compileSSA(0x19b969c0, 0x0)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:240 +0x2d
cmd/compile/internal/gc.compileFunctions.func2(0x19f55980, 0x19bef280, 0x0)
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:289 +0x3b
created by cmd/compile/internal/gc.compileFunctions
	/tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:287 +0xeb

/cc @josharian

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Aug 8, 2017
@ianlancetaylor
Copy link
Contributor

CC @mdempsky

Would be nice to figure out the cause in case this affects 1.9.

@josharian
Copy link
Contributor

josharian commented Aug 8, 2017

It believe affects 1.9, GO386=387 only. I'll try to send a CL soon.

@gopherbot
Copy link

Change https://golang.org/cl/54091 mentions this issue: cmd/compile: unexport gc.Sysfunc

@gopherbot
Copy link

Change https://golang.org/cl/54090 mentions this issue: cmd/compile: remove gc.Sysfunc calls from 387 backend

@josharian
Copy link
Contributor

I think CL 54090 should be cherry-picked to 1.9. (Thanks so very much for noticing and filing an issue, @martisch.)

The alternative for 1.9 is to disable concurrent compilation for GO386=387 in cmd/go and cmd/compile, but I think the proper fix is very low risk, perhaps even lower risk than the alternative.

@randall77
Copy link
Contributor

I concur, 54090 should be cherry-picked into 1.9.

@josharian josharian modified the milestones: Go1.9, Go1.10 Aug 9, 2017
@josharian
Copy link
Contributor

Re-opening for cherry-pick to 1.9.

@josharian josharian reopened this Aug 9, 2017
@ianlancetaylor
Copy link
Contributor

CC @broady

gopherbot pushed a commit that referenced this issue Aug 11, 2017
Updates #21352

Change-Id: If21342f30be32e25840b4072b932a6d4257b420d
Reviewed-on: https://go-review.googlesource.com/54091
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Avelino <t@avelino.xxx>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/55970 mentions this issue: [release-branch.go1.9] cmd/compile: remove gc.Sysfunc calls from 387 backend

gopherbot pushed a commit that referenced this issue Aug 22, 2017
…backend

[This is a cherry-pick of CL 54090 to the 1.9 release branch.]

gc.Sysfunc must not be called concurrently.
We set up runtime routines used by the backend
prior to doing any backend compilation.
I missed the 387 ones; fix that.

Sysfunc should have been unexported during 1.9.
I will rectify that in a subsequent CL.

Fixes #21352

Change-Id: I485bb1867b46d8e5cf64bc820b8963576dc16174
Reviewed-on: https://go-review.googlesource.com/55970
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
@broady broady closed this as completed Aug 22, 2017
@golang golang locked and limited conversation to collaborators Aug 22, 2018
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

6 participants