Closed
Description
Hi, I get a runtime error, when errlog.Debug(...)
is called multiple times in goroutine:
Error in main.routine: error 1
error in /home/vetti/projects/go/test-errlog/main.go (failing line not found, stack trace says func call is at line 12)
9: func routine(ch chan error, N int) {
10: for i := 0; i < N; i++ {
11: errlog.Debug(<-ch)
12: }
13: ch <- nil
Error: error 2
Errlog tried to debug the error but the stack trace seems empty. If you think this is an error, please open an issue at https://github.com/snwfdhmp/errlog/issues/new and provide us logs to investigate.
panic: runtime error: slice bounds out of range [16:14]
goroutine 19 [running]:
github.com/snwfdhmp/errlog.parseStackTrace(0x6, 0xc000062000, 0xc0000fbfb0, 0xc0000fbf40)
/home/vetti/go/pkg/mod/github.com/snwfdhmp/errlog@v0.0.0-20190809052339-ed8def38b5e4/regexp.go:41 +0x533
github.com/snwfdhmp/errlog.(*logger).Debug(0x930300, 0x7649c0, 0xc000085210, 0x101)
/home/vetti/go/pkg/mod/github.com/snwfdhmp/errlog@v0.0.0-20190809052339-ed8def38b5e4/logger.go:87 +0x77
github.com/snwfdhmp/errlog.Debug(0x7649c0, 0xc000085210, 0x1)
/home/vetti/go/pkg/mod/github.com/snwfdhmp/errlog@v0.0.0-20190809052339-ed8def38b5e4/errlog.go:89 +0x4c
main.routine(0xc0000740c0, 0x3)
/home/vetti/projects/go/test-errlog/main.go:11 +0x62
created by main.main
/home/vetti/projects/go/test-errlog/main.go:18 +0x65
exit status 2
This code reproduces this problem (playground or version 2):
package main
import (
"errors"
"github.com/snwfdhmp/errlog"
)
func routine(ch chan error, N int) {
for i := 0; i < N; i++ {
errlog.Debug(<-ch)
}
ch <- nil
}
func main() {
ch := make(chan error)
go routine(ch, 3)
ch <- errors.New("error 1")
ch <- errors.New("error 2")
ch <- errors.New("error 3")
<-ch
}
Why can this error occur?
Metadata
Metadata
Assignees
Labels
No labels