lnd icon indicating copy to clipboard operation
lnd copied to clipboard

GitHub: use bitcoind v26.0 for CI

Open guggero opened this issue 1 year ago • 6 comments

Depends on https://github.com/btcsuite/btcd/pull/2071.

Change Description

See if things break in the CI if we update to bitcoind v26.0.

guggero avatar Dec 12 '23 19:12 guggero

Okay, so the failed unit tests were due to a number of reasons:

  • bitcoind v26.0 doesn't have support for Unix Sockets (ipc://) in ZMQ anymore. Broken by https://github.com/bitcoin/bitcoin/pull/22087, will be fixed by https://github.com/bitcoin/bitcoin/pull/27679
  • We had frequent TCP listening port collisions, at least when running the tests locally
  • We didn't clean up temporary directories for bitcoind sometimes

I added a couple of commits to address these issues.

guggero avatar Dec 18 '23 17:12 guggero

Unit tests still failing. One of the itest failures has uncleaned shutdown that still occupying a port, werid

 unable to create server: listen tcp 127.0.0.1:6563: bind: address already in use 

yyforyongyu avatar Dec 21 '23 23:12 yyforyongyu

Yeah, it seems like I have to do some more digging into failures.

guggero avatar Dec 22 '23 07:12 guggero

[!IMPORTANT]

Auto Review Skipped

Auto reviews are limited to the following labels: llm-review. Please add one of these labels to enable auto reviews.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

coderabbitai[bot] avatar Feb 01 '24 15:02 coderabbitai[bot]

@Roasbeef can you see the logs of the failed Travis build? I only get this error message (not sure if we need to re-auth the app somehow?):

Screenshot from 2024-02-02 18-37-28

guggero avatar Feb 02 '24 17:02 guggero

@guggero

--- FAIL: TestLightningNetworkDaemon (26.84s)
FAIL
    harness_setup.go:45: 
        	Error Trace:	/home/travis/gopath/src/github.com/lightningnetwork/lnd/lntest/harness_setup.go:45
        	            				/home/travis/gopath/src/github.com/lightningnetwork/lnd/itest/lnd_test.go:97
        	Error:      	Received unexpected error:
        	            	invalid http POST response (nil), method: addnode, id: 1, last error=Post "http://127.0.0.1:9561": dial tcp 127.0.0.1:9561: connect: connection refused
        	Test:       	TestLightningNetworkDaemon
        	Messages:   	connect miner

https://app.travis-ci.com/github/lightningnetwork/lnd/builds/268702896

Roasbeef avatar Feb 22 '24 22:02 Roasbeef

Yeah, new failures keep popping up that I cannot easily reproduce locally. Or only with spending a lot of time on it, which I haven't found yet. Not sure if this is a priority, @saubyk?

guggero avatar Mar 02 '24 09:03 guggero

Yeah, new failures keep popping up that I cannot easily reproduce locally. Or only with spending a lot of time on it, which I haven't found yet. Not sure if this is a priority, @saubyk?

I am not aware of any critical dependency on bitcoind v26.0 for our imminent releases, so we can keep this at a lower priority

saubyk avatar Mar 02 '24 17:03 saubyk

@bitromortac: review reminder @ellemouton: review reminder @crypt-iq: review reminder @guggero, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Mar 11 '24 00:03 lightninglabs-deploy

Our CI is using bitcoind v23.0, and I think it's very important to test lnd against a newer version of bitcoind, there are new RPCs used but never checked in our CI, also the upcoming sweeper will also need a newer version of bitcoind.

Can take over if needed @guggero

yyforyongyu avatar Mar 13 '24 20:03 yyforyongyu

@yyforyongyu feel free to take over! I'm sure the failures are something small, just hard to find with some rounds of debugging required.

guggero avatar Mar 14 '24 08:03 guggero

cc: @ProofOfKeags for taking this over

saubyk avatar Mar 14 '24 15:03 saubyk

So here's what I've found out. The success/failure of the FilteredChainView tests is highly sensitive to whether other unit tests are running as well. This makes me think that our unit test suite somehow doesn't isolate the instances of the bitcoin node it is talking to.

  • If I run just the FilteredChainView tests, it always succeeds.
  • If I run the tests naively (allowing test caching), it usually succeeds in the limit case. Since only passing tests cache, I suspect that repeatedly running it stabilizes the test because fewer and fewer tests are competing for the same resource each run, reducing the race-y behavior
  • If I run the tests with nocache=1 it always fails.
  • Extending the timeout on the FilteredChainView tests does not seem to have an impact. I increased it from 20s to 30s since the test seems to reliably run in 20s. A 50% boost should be enough if it was truly a time budget issue.

Taking into consideration that this broke by upgrading from Core 23 to Core 26 is more perplexing. I'd expect race-y behavior to not depend on that.

ProofOfKeags avatar Mar 14 '24 20:03 ProofOfKeags

Thank you @ProofOfKeags for investigating! Your insights have given me another idea what the problem might be. The fact that running things in parallel causes the test to fail make me think the "per process unique port" generation mechanism doesn't work as expected. So I changed it to be unique per system, using a single file. Let's see how far that gets us...

guggero avatar Mar 15 '24 09:03 guggero

Okay, I think I have a version that should work. Wish me luck!

guggero avatar Mar 15 '24 17:03 guggero

Okay, I fixed a couple of more issues:

  • Postgres: Needed to increase the number of allowed connections. Now the "connection not found" should be gone.
  • Travis: They seem to filter on the branch name and refuse to build because the word "bitcoin" appears in it. They suck anyway and GitHub now has a macOS build on M1 that we can use for our ARM (arm64) builds. So I replaced the Travis build with an additional GitHub run (let's see how that one fares).
  • The sporadic failures in the routing/chainview tests were caused by not waiting for the backend node to fully start up. There seems to be an issue with the chain.BitcoindClient that it can get weirdly de-synchronized if Start() and NotifyBlocks() are called while the node is syncing with the chain still (if things are very slow and blocks come in between Start() and NotifyBlocks(), weird things start to happen). Waiting one second before using a chain backend solved that issue for now.

Things look way better now IMO. There still are a couple of flakes, but I think those were all pre-existing.

guggero avatar Mar 18 '24 14:03 guggero

Okay, this is as green as it will probably ever get. There are still a couple of (pre-existing!) flakes in there. But I vote to get this merged since they very likely don't have anything to do with bitcoind.

guggero avatar Mar 18 '24 20:03 guggero

btw can we update our merge rules to exclude the build from macOS?

yyforyongyu avatar Mar 19 '24 19:03 yyforyongyu

btw can we update our merge rules to exclude the build from macOS?

It's currently not included in the list of required tests. So merges shouldn't be blocked on it (same for Windows).

guggero avatar Mar 20 '24 07:03 guggero

FWIW https://github.com/bitcoin/bitcoin/pull/27679 is updated, has two ACKs already, and a review from an LND dev would be helpful to get a merge ;-)

pinheadmz avatar Apr 18 '24 13:04 pinheadmz