Skip to content

Commit

Permalink
Print stack when runtime panic occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
icza committed Aug 21, 2019
1 parent d3e2f48 commit 8a11c5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions repparser/repparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"errors"
"fmt"
"log"
"runtime"
"sort"
"time"

Expand Down Expand Up @@ -109,6 +110,9 @@ func parseProtected(dec repdecoder.Decoder, commands, mapData bool) (r *rep.Repl
defer func() {
if r := recover(); r != nil {
log.Printf("Parsing error: %v", r)
buf := make([]byte, 2000)
n := runtime.Stack(buf, false)
log.Printf("Stack: %s", buf[:n])
err = ErrParsing
}
}()
Expand Down

0 comments on commit 8a11c5f

Please sign in to comment.