Skip to content

Commit dd58782

Browse files
chore: add go stack trace for debug
1 parent 2420e7a commit dd58782

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

rolling-shutter/keyper/eonpkhandler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func (pkh *eonPubKeyHandler) loop(ctx context.Context) error {
6666
}
6767
select {
6868
case <-ctx.Done():
69+
t.Stop()
6970
return ctx.Err()
7071
case <-t.C:
7172
}

rolling-shutter/p2p/p2p.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package p2p
33
import (
44
"context"
55
"fmt"
6+
"runtime"
67
"sync"
78

89
"github.com/libp2p/go-libp2p"
@@ -121,6 +122,9 @@ func (p *P2PNode) Run(
121122
log.Error().Err(err).Msg("error closing dht")
122123
}
123124
log.Debug().Msg("host closed")
125+
buf := make([]byte, 1024*1024)
126+
stackSize := runtime.Stack(buf, true)
127+
log.Info().Msgf("stack: %s", string(buf[:stackSize]))
124128
return nil
125129
})
126130

@@ -171,8 +175,7 @@ func (p *P2PNode) Run(
171175
runner.Go(func() error {
172176
log.Info().Str("namespace", p.config.DiscoveryNamespace).Msg("starting advertizing discovery node")
173177
util.Advertise(ctx, p.discovery, p.config.DiscoveryNamespace)
174-
<-ctx.Done()
175-
return ctx.Err()
178+
return nil
176179
})
177180
runner.Go(func() error {
178181
return findPeers(ctx, p.host, p.discovery, p.config.DiscoveryNamespace)

0 commit comments

Comments
 (0)