Skip to content

Commit

Permalink
fix(plc4go/spi): print stack when panic is caught
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed May 9, 2023
1 parent 5b8995e commit 3011a3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plc4go/spi/RequestTransactionManager_test.go
Expand Up @@ -348,10 +348,12 @@ func Test_requestTransactionManager_processWorklog(t *testing.T) {
workLog: func() list.List {
l := list.New()
l.PushBack(&requestTransaction{
transactionId: 1,
transactionId: 1,
completionFuture: NewMockCompletionFuture(t),
})
l.PushBack(&requestTransaction{
transactionId: 2,
transactionId: 2,
completionFuture: NewMockCompletionFuture(t),
})
return *l
}(),
Expand Down
3 changes: 2 additions & 1 deletion plc4go/spi/utils/WorkerPool.go
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"runtime/debug"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -53,7 +54,7 @@ func (w *worker) initialize() {
func (w *worker) work() {
defer func() {
if recovered := recover(); recovered != nil {
log.Error().Msgf("Recovering from panic()=%v", recovered)
log.Error().Msgf("Recovering from panic():%v. Stack: %s", recovered, debug.Stack())
}
if !w.shutdown.Load() {
// if we are not in shutdown we continue
Expand Down

0 comments on commit 3011a3e

Please sign in to comment.