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: "fatal error: attempt to execute system stack code on user stack" in startTemplateThread #39098

prattmic opened this issue May 15, 2020 · 2 comments


Copy link

@prattmic prattmic commented May 15, 2020

From manual runs of, without the core runtime patch from the CL applied.

fatal error: attempt to execute system stack code on user stack                   
goroutine 8 [running]:
runtime.throw(0x50fbd9, 0x32)
        /usr/local/google/home/mpratt/src/go/src/runtime/panic.go:1116 +0x72 fp=0xc00004b6c0 sp=0xc00004b690 pc=0x4337f2                                            
        /usr/local/google/home/mpratt/src/go/src/runtime/stack.go:1320 +0x27 fp=0xc00004b6e0 sp=0xc00004b6c0 pc=0x462ba7                                            
runtime.stackfree(0xc000056000, 0xc000058000)                                     
        /usr/local/google/home/mpratt/src/go/src/runtime/stack.go:427 +0x36b fp=0xc00004b6e8 sp=0xc00004b6e0 pc=0x44a80b                                            
runtime.allocm(0x0, 0x511228, 0x45ff40)
        /usr/local/google/home/mpratt/src/go/src/runtime/proc.go:1440 +0xd7 fp=0xc00004b728 sp=0xc00004b6e8 pc=0x439397                                             
runtime.newm(0x511228, 0x0)
        /usr/local/google/home/mpratt/src/go/src/runtime/proc.go:1761 +0x39 fp=0xc00004b758 sp=0xc00004b728 pc=0x439b99                                             
        /usr/local/google/home/mpratt/src/go/src/runtime/proc.go:3773 +0x98 fp=0xc00004b778 sp=0xc00004b758 pc=0x43ee58
main.LockOSThreadTemplateThreadRace.func2(0xbfa7c99b86868dd1, 0x9c1163, 0x5ccae0, 0xc0000140d0)
        /usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/lockosthread.go:233 +0x6d fp=0xc00004b7c0 sp=0xc00004b778 pc=0x4d786d
        /usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc00004b7c8 sp=0xc00004b7c0 pc=0x465f81
created by main.LockOSThreadTemplateThreadRace
        /usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/lockosthread.go:225 +0xdf

It seems that newm simply must be called on the system stack, which is not done consistently (stoplockedm -> handoffp -> startm is another case).

cc @mknyszek @aclements

Copy link

@ALTree ALTree commented May 15, 2020

Also reported at #30591.

Copy link
Member Author

@prattmic prattmic commented May 15, 2020

Thanks, I missed that.

Duplicate of #30591.

@golang golang locked and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants