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

runtime: stoplockedm: inconsistent locking #46524

prattmic opened this issue Jun 2, 2021 · 2 comments

runtime: stoplockedm: inconsistent locking #46524

prattmic opened this issue Jun 2, 2021 · 2 comments


Copy link

@prattmic prattmic commented Jun 2, 2021


fatal error: stoplockedm: inconsistent locking

runtime stack:
runtime.throw(0x5a78b0, 0x21)
        /tmp/workdir/go/src/runtime/panic.go:1193 +0x74 fp=0x7384fbbffeb0 sp=0x7384fbbffe80 pc=0x43ee94
        /tmp/workdir/go/src/runtime/proc.go:2479 +0x2b0 fp=0x7384fbbfff00 sp=0x7384fbbffeb0 pc=0x446970
        /tmp/workdir/go/src/runtime/proc.go:3884 +0x179 fp=0x7384fbbfff30 sp=0x7384fbbfff00 pc=0x44a599
        /tmp/workdir/go/src/runtime/asm_amd64.s:341 +0x5a fp=0x7384fbbfff40 sp=0x7384fbbfff30 pc=0x471dfa

goroutine 1 [chan receive]:
runtime.gopark(0x5ae208, 0xc000198368, 0x170e, 0x2)
        /tmp/workdir/go/src/runtime/proc.go:334 +0x105 fp=0xc000098b48 sp=0xc000098b28 pc=0x441e65
runtime.chanrecv(0xc000198310, 0xc000098c4f, 0xc000000101, 0x4d85cb)
        /tmp/workdir/go/src/runtime/chan.go:576 +0x5f7 fp=0xc000098bd8 sp=0xc000098b48 pc=0x40d557
runtime.chanrecv1(0xc000198310, 0xc000098c4f)
        /tmp/workdir/go/src/runtime/chan.go:439 +0x2b fp=0xc000098c08 sp=0xc000098bd8 pc=0x40cf4b
testing.(*T).Run(0xc0000bec00, 0x5a1c03, 0xc, 0x5ab7b0, 0x488201)
        /tmp/workdir/go/src/testing/testing.go:1281 +0x3d2 fp=0xc000098ca0 sp=0xc000098c08 pc=0x4d85f2
        /tmp/workdir/go/src/testing/testing.go:1553 +0x85 fp=0xc000098cf0 sp=0xc000098ca0 pc=0x4d9f65
testing.tRunner(0xc00019a000, 0xc00007dde0)
        /tmp/workdir/go/src/testing/testing.go:1235 +0x102 fp=0xc000098d40 sp=0xc000098cf0 pc=0x4d7862
testing.runTests(0xc000194000, 0x8ab7e0, 0x59, 0x59, 0xc0143355ed0a8eb6, 0x8bb3a3bba2, 0x8c2fa0, 0x0)
        /tmp/workdir/go/src/testing/testing.go:1551 +0x450 fp=0xc000098e10 sp=0xc000098d40 pc=0x4d9e10
testing.(*M).Run(0xc00018e000, 0x0)
        /tmp/workdir/go/src/testing/testing.go:1459 +0x25b fp=0xc000098f20 sp=0xc000098e10 pc=0x4d8abb
        _testmain.go:225 +0x165 fp=0xc000098f88 sp=0xc000098f20 pc=0x55d3a5
        /tmp/workdir/go/src/runtime/proc.go:223 +0x248 fp=0xc000098fe0 sp=0xc000098f88 pc=0x441a08
        /tmp/workdir/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000098fe8 sp=0xc000098fe0 pc=0x473f81

An internal test triggered this same crash and a bisect identified as the cause. Likely the assertion in the comment is not always true, but I'll need to look more closely.

cc @mknyszek @ianlancetaylor

@prattmic prattmic added this to the Go1.17 milestone Jun 2, 2021
@prattmic prattmic self-assigned this Jun 2, 2021
Copy link
Member Author

@prattmic prattmic commented Jun 2, 2021

The problem is that earlier in exitsyscall0 we put gp on the global runq, allowing us to race reading gp.lockedm with another M running gp (which wasn't locked) and having it call lockOSThread, thus setting gp.lockedm.

CL forthcoming.


Copy link

@gopherbot gopherbot commented Jun 2, 2021

Change mentions this issue: runtime: avoid gp.lockedm race in exitsyscall0


@gopherbot gopherbot closed this in e0d029f Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants