Skip to content

Conversation

@alexanderwiederin
Copy link
Contributor

@alexanderwiederin alexanderwiederin commented Mar 28, 2025

Fix Esplora connection issues in Python tests

Description

This PR addresses the intermittent CI failures in Python tests where connection to the Esplora server was being reset ("Connection reset by peer" errors).

Changes

  • Added retry logic with timeouts to the Python test functions that communicate with Esplora
  • Added proper exception handling to continue retrying after connection errors
  • Used a shorter sleep interval (0.5s) to match the more successful Kotlin implementation
  • Added helpful error messages and maximum retry limits for better debugging

These changes will make our CI pipeline more stable and reduce false negative test failures.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 28, 2025

🎉 This PR is now ready for review!
Please choose at least one reviewer by assigning them on the right bar.
If no reviewers are assigned within 10 minutes, I'll automatically assign one.
Once the first reviewer has submitted a review, a second will be assigned.

@tnull tnull self-requested a review March 28, 2025 09:39
@alexanderwiederin alexanderwiederin marked this pull request as ready for review March 28, 2025 10:29
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at this!

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@alexanderwiederin alexanderwiederin force-pushed the fix-flaky-python-test branch 2 times, most recently from 9225712 to 0704414 Compare March 28, 2025 11:35
- Add timeout, max retries, and error handling to wait_for_block and wait_for_tx functions in Python tests
- Catch and log connection errors instead of failing immediately
- Use shorter sleep interval (0.5s) to match Kotlin implementation
- Add error messages during retries

This addresses the "Connection reset by peer" errors in CI by making the Python tests more resilient to temporary network issues when connecting to the Esplora API.
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@tnull tnull merged commit abdcc6a into lightningdevkit:main Mar 31, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants