Skip to content

Commit

Permalink
Detect early and abnormal dcrd process shutdown
Browse files Browse the repository at this point in the history
Avoids waiting for a 10m timeout in go test, that ultimately results in the
test being killed without any debug information available read from stdout or
stderr.
  • Loading branch information
jrick authored and davecgh committed Apr 4, 2024
1 parent 3d06801 commit 058929f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dcrdtest/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,19 @@ func (n *node) start(ctx context.Context) error {
return err
}

earlyShutdown := make(chan error, 1)
go func() {
earlyShutdown <- cmd.Wait()
}()

// Read the RPC and P2P addresses.
select {
case <-ctx.Done():
_ = n.stop() // Cleanup what has been done so far.
return ctx.Err()
case err := <-earlyShutdown:
_ = n.stop()
return err
case <-gotSubsysAddrs:
n.p2pAddr = p2pAddr
n.rpcAddr = rpcAddr
Expand Down

0 comments on commit 058929f

Please sign in to comment.