From 25d56eda6f6c6748d9243a5747b7e6cf70599e84 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 13 Apr 2018 09:09:26 +0200 Subject: [PATCH 1/3] lntest: timeout if process not exited in 1 minute --- lntest/node.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lntest/node.go b/lntest/node.go index 1122e088..502ae52f 100644 --- a/lntest/node.go +++ b/lntest/node.go @@ -429,7 +429,12 @@ func (hn *HarnessNode) stop() error { } // Wait for lnd process and other goroutines to exit. - <-hn.processExit + select { + case <-hn.processExit: + case <-time.After(60 * time.Second): + return fmt.Errorf("process did not exit") + } + close(hn.quit) hn.wg.Wait() From c5169a79f597526486755af19e6220ae162a3b77 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 13 Apr 2018 11:28:52 +0200 Subject: [PATCH 2/3] contractcourt/channel_arbitrator: add missing return on resolver exit This commit adds a missing return to the resolveContract method, that will ensure the goroutine exits if the ChannelArbitrator shuts down. This fixes a potential deadlock during the integration tests. We also promote some of the logs to Debug from Trace. --- contractcourt/channel_arbitrator.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 58c5c211..11402bef 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -1162,11 +1162,14 @@ func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) { // Until the contract is fully resolved, we'll continue to iteratively // resolve the contract one step at a time. for !currentContract.IsResolved() { + log.Debugf("ChannelArbitrator(%v): contract %T not yet resolved", + c.cfg.ChanPoint, currentContract) select { // If we've been signalled to quit, then we'll exit early. case <-c.quit: + return default: // Otherwise, we'll attempt to resolve the current @@ -1174,7 +1177,8 @@ func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) { nextContract, err := currentContract.Resolve() if err != nil { log.Errorf("ChannelArbitrator(%v): unable to "+ - "progress resolver: %v", c.cfg.ChanPoint, err) + "progress resolver: %v", + c.cfg.ChanPoint, err) return } @@ -1185,7 +1189,7 @@ func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) { // within our logs: the new contract will take the // place of the old one. case nextContract != nil: - log.Tracef("ChannelArbitrator(%v): swapping "+ + log.Debugf("ChannelArbitrator(%v): swapping "+ "out contract %T for %T ", c.cfg.ChanPoint, currentContract, nextContract) @@ -1206,7 +1210,7 @@ func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) { // If this contract is actually fully resolved, then // we'll mark it as such within the database. case currentContract.IsResolved(): - log.Tracef("ChannelArbitrator(%v): marking "+ + log.Debugf("ChannelArbitrator(%v): marking "+ "contract %T fully resolved", c.cfg.ChanPoint, currentContract) From 44f0ec92638d1f1ccc8f718e5b1c07c8d2842e82 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 13 Apr 2018 12:07:58 +0200 Subject: [PATCH 3/3] lnd_test: increase timeout for mempool tx --- lnd_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index dd1c5878..938c5311 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -6252,9 +6252,9 @@ func testMultHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, // Bob's sweeping transaction should now be found in the mempool at // this point. - _, err = waitForTxInMempool(net.Miner.Node, time.Second*10) + _, err = waitForTxInMempool(net.Miner.Node, time.Second*20) if err != nil { - t.Fatalf("unable to find bob's sweeping transaction") + t.Fatalf("unable to find bob's sweeping transaction: %v", err) } // If we mine an additional block, then this should confirm Bob's