From f4faca60135bea528a29f454876efa642b00665e Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 17 Oct 2017 00:31:56 +0200 Subject: [PATCH] runtime: don't terminate locked OS threads on Plan 9 CL 46037 and CL 46038 implemented termination of locked OS threads when the goroutine exits. However, this behavior leads to crashes of Go programs using runtime.LockOSThread on Plan 9. This is notably the case of the os/exec and net packages. This change disables termination of locked OS threads on Plan 9. Updates #22227. Change-Id: If9fa241bff1c0b68e7e9e321e06e5203b3923212 Reviewed-on: https://go-review.googlesource.com/71230 Reviewed-by: Austin Clements Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/runtime/proc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 4133b235849..48ce7d62488 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2671,7 +2671,9 @@ func goexit0(gp *g) { // Return to mstart, which will release the P and exit // the thread. - gogo(&_g_.m.g0.sched) + if GOOS != "plan9" { // See golang.org/issue/22227. + gogo(&_g_.m.g0.sched) + } } schedule() }