
If CurrentThread isn't running a goroutine SelectedGoroutine can be nil, do not blindly dereference it. Fixes #827
24 lines
428 B
Go
24 lines
428 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"sync"
|
|
)
|
|
|
|
func main() {
|
|
http.HandleFunc("/test", func(w http.ResponseWriter, req *http.Request) {
|
|
go func() {
|
|
// I know this is wrong, it is just to simulate a deadlocked goroutine
|
|
fmt.Println("locking...")
|
|
mtx := &sync.Mutex{}
|
|
mtx.Lock()
|
|
mtx.Lock()
|
|
fmt.Println("will never print this")
|
|
}()
|
|
})
|
|
|
|
log.Fatalln(http.ListenAndServe("127.0.0.1:8888", nil))
|
|
}
|