]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "runtime: Goexit on C-created thread report more useful error message"
authorTim King <taking@google.com>
Tue, 10 Sep 2024 22:56:40 +0000 (22:56 +0000)
committerTim King <taking@google.com>
Tue, 10 Sep 2024 23:32:53 +0000 (23:32 +0000)
This reverts CL 602296.

Reason for revert: Failing on several builders.

Change-Id: I889c566d34294032c330d4f9402300ad0d5d3bf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/611919
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/runtime/panic.go
src/runtime/proc.go
src/runtime/proc_test.go
src/runtime/testdata/testprogcgo/callback.go

index ed08bf4f3008974ac7c1e15ee32116ea877dc1d0..bd1ea096aa2a013de74c713b3eaeed4c6a3a262a 100644 (file)
@@ -614,8 +614,6 @@ func deferreturn() {
 // without func main returning. Since func main has not returned,
 // the program continues execution of other goroutines.
 // If all other goroutines exit, the program crashes.
-//
-// It crashes if called from a thread not created by the Go runtime.
 func Goexit() {
        // Create a panic object for Goexit, so we can recognize when it might be
        // bypassed by a recover().
index 0909d138ff774e1bc82bbb5a46c6b0da6df797f9..c4db86225df2615f901a1bbc636bd108e5504136 100644 (file)
@@ -4321,9 +4321,6 @@ func gdestroy(gp *g) {
 
        if locked && mp.lockedInt != 0 {
                print("runtime: mp.lockedInt = ", mp.lockedInt, "\n")
-               if mp.isextra {
-                       throw("runtime.Goexit called in a thread that was not created by the Go runtime")
-               }
                throw("exited a goroutine internally locked to the OS thread")
        }
        gfput(pp, gp)
index 0a542409842cba499830b884fda20c71e7b52d53..a930ea707f12ccd3601e2c53af53ddf2631d57e6 100644 (file)
@@ -1158,13 +1158,3 @@ func TestBigGOMAXPROCS(t *testing.T) {
                t.Errorf("output:\n%s\nwanted:\nunknown function: NonexistentTest", output)
        }
 }
-
-func TestCgoToGoCallGoexit(t *testing.T) {
-       if runtime.GOOS == "plan9" || runtime.GOOS == "windows" {
-               t.Skipf("no pthreads on %s", runtime.GOOS)
-       }
-       output := runTestProg(t, "testprogcgo", "CgoToGoCallGoexit")
-       if !strings.Contains(output, "runtime.Goexit called in a thread that was not created by the Go runtime") {
-               t.Fatalf("output should contain %s, got %s", "runtime.Goexit called in a thread that was not created by the Go runtime", output)
-       }
-}
index 39993f13a678a518b964210119f338de944e9c5b..319572fe1090348714b5b1c1b24c894663debbdd 100644 (file)
@@ -38,21 +38,10 @@ import (
 
 func init() {
        register("CgoCallbackGC", CgoCallbackGC)
-       register("CgoToGoCallGoexit", CgoToGoCallGoexit)
 }
 
-func CgoToGoCallGoexit() {
-       goexit = true
-       C.foo()
-}
-
-var goexit = false
-
 //export go_callback
 func go_callback() {
-       if goexit {
-               runtime.Goexit()
-       }
        if e := extraMInUse.Load(); e == 0 {
                fmt.Printf("in callback extraMInUse got %d want >0\n", e)
                os.Exit(1)