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

html/template: sync: RUnlock of unlocked RWMutex [Go 1.16 regression] #43885

Closed
eclipseo opened this issue Jan 24, 2021 · 4 comments
Closed

html/template: sync: RUnlock of unlocked RWMutex [Go 1.16 regression] #43885

eclipseo opened this issue Jan 24, 2021 · 4 comments

Comments

@eclipseo
Copy link

eclipseo commented Jan 24, 2021

What version of Go are you using (go version)?

Go 1.16 beta 1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Fedora Rawhide, any arches.

What did you do?

Building and running test for github.com/prometheus/alertmanager

What did you expect to see?

No test failure.

What did you see instead?

github.com/prometheus/alertmanager/template
fatal error: sync: RUnlock of unlocked RWMutex
goroutine 59 [running]:
runtime.throw(0x5606e6807e3e, 0x21)
	/usr/lib/golang/src/runtime/panic.go:1112 +0x74 fp=0xc00019d288 sp=0xc00019d258 pc=0x5606e6452634
sync.throw(0x5606e6807e3e, 0x21)
	/usr/lib/golang/src/runtime/panic.go:1098 +0x37 fp=0xc00019d2a8 sp=0xc00019d288 pc=0x5606e64868f7
sync.(*RWMutex).rUnlockSlow(0xc0004be600, 0xffffffff)
	/usr/lib/golang/src/sync/rwmutex.go:93 +0x45 fp=0xc00019d2d0 sp=0xc00019d2a8 pc=0x5606e6495c25
sync.(*RWMutex).RUnlock(...)
	/usr/lib/golang/src/sync/rwmutex.go:83
html/template.(*Template).wrapFuncs.func1(0xc00000f920, 0x1, 0x1, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/html/template/template.go:400 +0x1fb fp=0xc00019d350 sp=0xc00019d2d0 pc=0x5606e65df43b
reflect.callReflect(0xc0004adbc0, 0xc00019d4b8, 0xc00019d4a0)
	/usr/lib/golang/src/reflect/value.go:565 +0x32d fp=0xc00019d488 sp=0xc00019d350 pc=0x5606e64f5fad
reflect.makeFuncStub(0x5606e6801e10, 0x3, 0x0, 0x0, 0xc00019d6e0, 0x5606e64f50e7, 0xc0001df710, 0xc0004adbc0, 0xc0004a14c0, 0x1000000020, ...)
	/usr/lib/golang/src/reflect/asm_amd64.s:22 +0x44 fp=0xc00019d4b8 sp=0xc00019d488 pc=0x5606e65005a4
runtime.call32(0xc0001df710, 0xc0004adbc0, 0xc0004a14c0, 0x1000000020)
	/usr/lib/golang/src/runtime/asm_amd64.s:547 +0x40 fp=0xc00019d4e8 sp=0xc00019d4b8 pc=0x5606e6489800
reflect.Value.call(0x5606e6b1e7a0, 0xc0004adbc0, 0x13, 0x5606e67f6587, 0x4, 0xc00000f908, 0x1, 0x1, 0x5606e6b149a0, 0xc00000f908, ...)
	/usr/lib/golang/src/reflect/value.go:476 +0x8e7 fp=0xc00019d6f0 sp=0xc00019d4e8 pc=0x5606e64f50e7
reflect.Value.Call(0x5606e6b1e7a0, 0xc0004adbc0, 0x13, 0xc00000f908, 0x1, 0x1, 0xc0000a6c00, 0x0, 0xc00019d7e0)
	/usr/lib/golang/src/reflect/value.go:337 +0xb9 fp=0xc00019d770 sp=0xc00019d6f0 pc=0x5606e64f45b9
text/template.safeCall(0x5606e6b1e7a0, 0xc0004adbc0, 0x13, 0xc00000f908, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	/usr/lib/golang/src/text/template/funcs.go:365 +0xbf fp=0xc00019d7f0 sp=0xc00019d770 pc=0x5606e65ab43f
text/template.(*state).evalCall(0xc00019dd48, 0x0, 0x0, 0x0, 0x5606e6b1e7a0, 0xc0004adbc0, 0x13, 0x5606e6bacf78, 0xc0004bda70, 0x5606e6801e17, ...)
	/usr/lib/golang/src/text/template/exec.go:725 +0x689 fp=0xc00019d920 sp=0xc00019d7f0 pc=0x5606e65a4b69
text/template.(*state).evalFunction(0xc00019dd48, 0x0, 0x0, 0x0, 0xc0004bdaa0, 0x5606e6bacf78, 0xc0004bda70, 0xc0004a3480, 0x1, 0x1, ...)
	/usr/lib/golang/src/text/template/exec.go:580 +0x172 fp=0xc00019da08 sp=0xc00019d920 pc=0x5606e65a3532
text/template.(*state).evalCommand(0xc00019dd48, 0x0, 0x0, 0x0, 0xc0004bda70, 0x5606e6b149a0, 0xc0004a34c0, 0x98, 0x5606e6b149a0, 0xc0004a34c0, ...)
	/usr/lib/golang/src/text/template/exec.go:467 +0x125 fp=0xc00019dad8 sp=0xc00019da08 pc=0x5606e65a1b45
text/template.(*state).evalPipeline(0xc00019dd48, 0x0, 0x0, 0x0, 0xc0004be6c0, 0x0, 0x5606e642dcc2, 0xc00019dc80)
	/usr/lib/golang/src/text/template/exec.go:436 +0x125 fp=0xc00019dbc8 sp=0xc00019dad8 pc=0x5606e65a15c5
text/template.(*state).walk(0xc00019dd48, 0x0, 0x0, 0x0, 0x5606e6bace58, 0xc0004bdad0)
	/usr/lib/golang/src/text/template/exec.go:255 +0x38a fp=0xc00019dc50 sp=0xc00019dbc8 pc=0x5606e659ff2a
text/template.(*state).walk(0xc00019dd48, 0x0, 0x0, 0x0, 0x5606e6bad128, 0xc0004bda10)
	/usr/lib/golang/src/text/template/exec.go:264 +0x13c fp=0xc00019dcd8 sp=0xc00019dc50 pc=0x5606e659fcdc
text/template.(*Template).execute(0xc0004b6ac0, 0x5606e6ba52b8, 0xc0004bdb00, 0x0, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/text/template/exec.go:220 +0x1c6 fp=0xc00019ddb0 sp=0xc00019dcd8 pc=0x5606e659f9e6
text/template.(*Template).Execute(...)
	/usr/lib/golang/src/text/template/exec.go:203
html/template.(*Template).Execute(0xc0004bd770, 0x5606e6ba52b8, 0xc0004bdb00, 0x0, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/html/template/template.go:139 +0xd0 fp=0xc00019de10 sp=0xc00019ddb0 pc=0x5606e65d9990
github.com/prometheus/alertmanager/template.(*Template).ExecuteHTMLString(0xc00000ec18, 0x5606e6801e0c, 0x16, 0x0, 0x0, 0x5606e652ee80, 0x5606e6d4cbe8, 0x5606e6dc23e0, 0x5606e647bc00)
	/builddir/build/BUILD/alertmanager-0.21.0/_build/src/github.com/prometheus/alertmanager/template/template.go:121 +0x165 fp=0xc00019de90 sp=0xc00019de10 pc=0x5606e67ee925
github.com/prometheus/alertmanager/template.(*Template).ExecuteHTMLString-fm(0x5606e6801e0c, 0x16, 0x0, 0x0, 0x0, 0x0, 0xc000486748, 0x5606e648849b)
	/builddir/build/BUILD/alertmanager-0.21.0/_build/src/github.com/prometheus/alertmanager/template/template.go:108 +0x65 fp=0xc00019dee8 sp=0xc00019de90 pc=0x5606e67f5005
github.com/prometheus/alertmanager/template.TestTemplateExpansion.func1(0xc0003fcd80)
	/builddir/build/BUILD/alertmanager-0.21.0/_build/src/github.com/prometheus/alertmanager/template/template_test.go:380 +0xa6 fp=0xc00019df80 sp=0xc00019dee8 pc=0x5606e67f4946
testing.tRunner(0xc0003fcd80, 0xc00049f8c0)
	/usr/lib/golang/src/testing/testing.go:1194 +0xef fp=0xc00019dfd0 sp=0xc00019df80 pc=0x5606e652ef6f
runtime.goexit()
	/usr/lib/golang/src/runtime/asm_amd64.s:1367 +0x1 fp=0xc00019dfd8 sp=0xc00019dfd0 pc=0x5606e648b1e1
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1239 +0x2b3
goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001e8f00, 0x5606e680108b, 0x15, 0x5606e6b9c628, 0x5606e64a9901)
	/usr/lib/golang/src/testing/testing.go:1240 +0x2da
testing.runTests.func1(0xc000001c80)
	/usr/lib/golang/src/testing/testing.go:1512 +0x7a
testing.tRunner(0xc000001c80, 0xc0001c7de0)
	/usr/lib/golang/src/testing/testing.go:1194 +0xef
testing.runTests(0xc00000ea68, 0x5606e6df2d80, 0x8, 0x8, 0xbff8e2ddc54a8518, 0x8bb31758d3, 0x5606e6dfd4e0, 0x5606e67fcdf2)
	/usr/lib/golang/src/testing/testing.go:1510 +0x310
testing.(*M).Run(0xc0001a4280, 0x0)
	/usr/lib/golang/src/testing/testing.go:1418 +0x1eb
main.main()
	_testmain.go:57 +0x138
goroutine 35 [chan receive]:
testing.(*T).Run(0xc0003fcd80, 0x5606e6804753, 0x1c, 0xc00049f8c0, 0xc0003e6001)
	/usr/lib/golang/src/testing/testing.go:1240 +0x2da
github.com/prometheus/alertmanager/template.TestTemplateExpansion(0xc0001e8f00)
	/builddir/build/BUILD/alertmanager-0.21.0/_build/src/github.com/prometheus/alertmanager/template/template_test.go:375 +0x3de
testing.tRunner(0xc0001e8f00, 0x5606e6b9c628)
	/usr/lib/golang/src/testing/testing.go:1194 +0xef
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1239 +0x2b3
exit status 2
FAIL	github.com/prometheus/alertmanager/template	0.018s

I'm filing the bug here because the backtrace suggests the issue is located in html/template. Moreover there was a recent commit regarding data race in 5a4db10

@eclipseo
Copy link
Author

Pinging @ianlancetaylor for input on this one.

@davecheney
Copy link
Contributor

Have you tried running the test under the race detector? See https://blog.golang.org/race-detector .

@tmthrgd
Copy link
Contributor

tmthrgd commented Jan 25, 2021

I believe this is a duplicate of #43295 which has been fixed. Also see #43855.

@eclipseo
Copy link
Author

Thankt, it seems indeed to be that duplicate, I'll test in next beta and reopen if necessary.

@golang golang locked and limited conversation to collaborators Jan 25, 2022
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