Skip to content

Commit

Permalink
tmp debug: log goroutine dump when stopdaemon requested instead
Browse files Browse the repository at this point in the history
  • Loading branch information
aakselrod committed Dec 6, 2024
1 parent be50fff commit 2e6d473
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 0 additions & 13 deletions funding/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/binary"
"fmt"
"io"
"runtime"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -784,24 +783,12 @@ func (f *Manager) Stop() error {
defer log.Debug("Funding manager shutdown complete")

close(f.quit)
log.Infof("%s", stack())
f.wg.Wait()
})

return nil
}

func stack() []byte {
buf := make([]byte, 1024)
for {
n := runtime.Stack(buf, true)
if n < len(buf) {
return buf[:n]
}
buf = make([]byte, 2*len(buf))
}
}

// rebroadcastFundingTx publishes the funding tx on startup for each
// unconfirmed channel.
func (f *Manager) rebroadcastFundingTx(c *channeldb.OpenChannel) {
Expand Down
13 changes: 13 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7042,6 +7042,17 @@ func (r *rpcServer) GetNetworkInfo(ctx context.Context,
return netInfo, nil
}

func stack() []byte {
buf := make([]byte, 1024)
for {
n := runtime.Stack(buf, true)
if n < len(buf) {
return buf[:n]
}
buf = make([]byte, 2*len(buf))
}
}

// StopDaemon will send a shutdown request to the interrupt handler, triggering
// a graceful shutdown of the daemon.
func (r *rpcServer) StopDaemon(_ context.Context,
Expand All @@ -7062,6 +7073,8 @@ func (r *rpcServer) StopDaemon(_ context.Context,
"shut down, please wait until rescan finishes")
}

rpcsLog.Infof("%s", stack())

r.interceptor.RequestShutdown()

return &lnrpc.StopResponse{
Expand Down

0 comments on commit 2e6d473

Please sign in to comment.