File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ package sync
4
4
5
5
import (
6
6
"bytes"
7
- "fmt"
8
7
"github.com/funny/goid"
9
8
"runtime/pprof"
10
9
"strconv"
@@ -73,19 +72,21 @@ func (m *mointor) wait() int32 {
73
72
func (m * mointor ) verify (holder int32 , holderLink []int32 ) {
74
73
if m .holder != 0 {
75
74
if m .holder == holder {
76
- buf := new (bytes.Buffer )
77
- fmt .Fprintln (buf , "[DEAD LOCK]\n " )
78
-
79
- // dump goroutines
75
+ // dump stack
80
76
stackBuf := new (bytes.Buffer )
81
77
prof := pprof .Lookup ("goroutine" )
82
78
prof .WriteTo (stackBuf , 2 )
83
79
stack := stackBuf .Bytes ()
84
- fmt .Fprintf (buf , "%s\n \n " , traceGoroutine (holder , stack ))
80
+
81
+ // match goroutines
82
+ buf := new (bytes.Buffer )
83
+ buf .WriteString ("[DEAD LOCK]\n " )
84
+ buf .Write (traceGoroutine (holder , stack ))
85
+ buf .Write (goroutineEnd )
85
86
for i := 0 ; i < len (holderLink ); i ++ {
86
- fmt .Fprintf (buf , "%s\n \n " , traceGoroutine (holderLink [i ], stack ))
87
+ buf .Write (traceGoroutine (holderLink [i ], stack ))
88
+ buf .Write (goroutineEnd )
87
89
}
88
-
89
90
panic (buf .String ())
90
91
}
91
92
if waitTarget , exists := waitTargets [m .holder ]; exists {
You can’t perform that action at this time.
0 commit comments