From ddceb2b15b5a7c04e7620be07ebdb795c2d112e9 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 12 Jun 2024 02:19:22 +0800 Subject: [PATCH 1/4] lntest: increase timeout for postgres backend Also decrease timeout values for other builds. --- lntest/wait/timeouts.go | 2 +- lntest/wait/timeouts_darwin.go | 2 +- lntest/wait/timeouts_remote_db.go | 21 +++++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lntest/wait/timeouts.go b/lntest/wait/timeouts.go index 21c99959b..f8239799b 100644 --- a/lntest/wait/timeouts.go +++ b/lntest/wait/timeouts.go @@ -16,7 +16,7 @@ const ( // ChannelCloseTimeout is the max time we will wait before a channel is // considered closed. - ChannelCloseTimeout = time.Second * 60 + ChannelCloseTimeout = time.Second * 30 // DefaultTimeout is a timeout that will be used for various wait // scenarios where no custom timeout value is defined. diff --git a/lntest/wait/timeouts_darwin.go b/lntest/wait/timeouts_darwin.go index bc9ff2144..f992d06b2 100644 --- a/lntest/wait/timeouts_darwin.go +++ b/lntest/wait/timeouts_darwin.go @@ -16,7 +16,7 @@ const ( // ChannelCloseTimeout is the max time we will wait before a channel is // considered closed. - ChannelCloseTimeout = time.Second * 60 + ChannelCloseTimeout = time.Second * 30 // DefaultTimeout is a timeout that will be used for various wait // scenarios where no custom timeout value is defined. diff --git a/lntest/wait/timeouts_remote_db.go b/lntest/wait/timeouts_remote_db.go index 470cc3aa8..43cd6e022 100644 --- a/lntest/wait/timeouts_remote_db.go +++ b/lntest/wait/timeouts_remote_db.go @@ -6,34 +6,39 @@ package wait import "time" const ( + // extraTimeout is the additional time we wait for the postgres backend + // until the issue is resolved: + // - https://github.com/lightningnetwork/lnd/issues/8809 + extraTimeout = time.Second * 30 + // MinerMempoolTimeout is the max time we will wait for a transaction // to propagate to the mining node's mempool. - MinerMempoolTimeout = time.Minute + MinerMempoolTimeout = time.Minute + extraTimeout // ChannelOpenTimeout is the max time we will wait before a channel to // be considered opened. - ChannelOpenTimeout = time.Second * 30 + ChannelOpenTimeout = time.Second*30 + extraTimeout // ChannelCloseTimeout is the max time we will wait before a channel is // considered closed. - ChannelCloseTimeout = time.Second * 30 + ChannelCloseTimeout = time.Second*30 + extraTimeout // DefaultTimeout is a timeout that will be used for various wait // scenarios where no custom timeout value is defined. - DefaultTimeout = time.Second * 60 + DefaultTimeout = time.Second*60 + extraTimeout // AsyncBenchmarkTimeout is the timeout used when running the async // payments benchmark. - AsyncBenchmarkTimeout = time.Minute * 2 + AsyncBenchmarkTimeout = time.Minute*2 + extraTimeout // NodeStartTimeout is the timeout value when waiting for a node to // become fully started. - NodeStartTimeout = time.Minute * 2 + NodeStartTimeout = time.Minute*2 + extraTimeout // SqliteBusyTimeout is the maximum time that a call to the sqlite db // will wait for the connection to become available. - SqliteBusyTimeout = time.Second * 10 + SqliteBusyTimeout = time.Second*10 + extraTimeout // PaymentTimeout is the timeout used when sending payments. - PaymentTimeout = time.Second * 60 + PaymentTimeout = time.Second*60 + extraTimeout ) From 9f34a4dc54faee5e96cbbe1e5e23b562ec218459 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 12 Jun 2024 03:40:49 +0800 Subject: [PATCH 2/4] itest: skip error assertion when parent context finishes We may get a flake like the following, ``` lnd_route_blinding_test.go:468: Error Trace: /Users/runner/work/lnd/lnd/itest/lnd_route_blinding_test.go:468 /Users/runner/hostedtoolcache/go/1.22.3/arm64/src/runtime/asm_arm64.s:1222 Error: Received unexpected error: rpc error: code = Canceled desc = context canceled Test: TestLightningNetworkDaemon/tranche15/144-of-156/bitcoind/disable_introduction_node ``` This happens when the test successfully finishes, the parent context is canceled, causing the child context to return an error. We fix it by ignoring it in the goroutine. --- itest/lnd_route_blinding_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/itest/lnd_route_blinding_test.go b/itest/lnd_route_blinding_test.go index 4b0eef859..5c32a85a3 100644 --- a/itest/lnd_route_blinding_test.go +++ b/itest/lnd_route_blinding_test.go @@ -5,6 +5,7 @@ import ( "context" "crypto/sha256" "encoding/hex" + "errors" "time" "github.com/btcsuite/btcd/btcec/v2" @@ -465,6 +466,14 @@ func (b *blindedForwardTest) sendBlindedPayment(ctx context.Context, ctx, cancel := context.WithTimeout(ctx, time.Hour) go func() { _, err := b.ht.Alice.RPC.Router.SendToRouteV2(ctx, sendReq) + + // We may get a context canceled error when the test is + // finished. + if errors.Is(err, context.Canceled) { + b.ht.Logf("sendBlindedPayment: parent context canceled") + return + } + require.NoError(b.ht, err) }() From 6de1b026ddeee2deb7d6b93ea4f827200d4ba7a0 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 12 Jun 2024 03:49:04 +0800 Subject: [PATCH 3/4] chainntnfs: add verbose logging in unit test --- chainntnfs/bitcoindnotify/bitcoind_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chainntnfs/bitcoindnotify/bitcoind_test.go b/chainntnfs/bitcoindnotify/bitcoind_test.go index 8d54439a6..34b93068a 100644 --- a/chainntnfs/bitcoindnotify/bitcoind_test.go +++ b/chainntnfs/bitcoindnotify/bitcoind_test.go @@ -100,7 +100,9 @@ func syncNotifierWithMiner(t *testing.T, notifier *BitcoindNotifier, select { case <-time.After(100 * time.Millisecond): case <-timeout: - t.Fatalf("timed out waiting to sync notifier") + t.Fatalf("timed out in syncNotifierWithMiner, got "+ + "err=%v, minerHeight=%v, bitcoindHeight=%v", + err, minerHeight, bitcoindHeight) } } } From 84e58d6f027be6e1ac50b7c51f1823bb6dff2d64 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 12 Jun 2024 16:11:44 +0800 Subject: [PATCH 4/4] workflows: decrease TRANCHES to 8 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 35ac97c0a..a9217f555 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ defaults: env: BITCOIN_VERSION: "27" - TRANCHES: 16 + TRANCHES: 8 # If you change this value, please change it in the following files as well: # /.travis.yml