Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: fix http RoundTripper #6267

Merged

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Mar 7, 2025

Summary

Catchpoint downloading uses http.Client with http.Request's context with timeout set to MaxCatchpointDownloadDuration=43200 seconds. If p2p nodes do not respond, this context never expires so that http.Client waits for MaxCatchpointDownloadDuration.
Fixed by copying libp2phttp.streamRoundTripper.RoundTrip but using sensible context with timeout on NewStream call.

Closes #6265

Test Plan

Tested manually with catchpointdump and goal node catchup:

  • catchpointdump successfully exits when run agains a node that does not respond
  • p2p-only algod was fully caught up in under 2h

@algorandskiy algorandskiy added Bug-Fix p2p Work related to the p2p project labels Mar 7, 2025
@algorandskiy algorandskiy requested review from cce, jannotti and gmalouf March 7, 2025 00:04
@algorandskiy algorandskiy self-assigned this Mar 7, 2025
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 44 lines in your changes missing coverage. Please review.

Project coverage is 51.78%. Comparing base (d44aa2d) to head (b7876cc).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
network/p2p/http.go 0.00% 44 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6267      +/-   ##
==========================================
- Coverage   51.80%   51.78%   -0.03%     
==========================================
  Files         644      644              
  Lines       86655    86697      +42     
==========================================
+ Hits        44893    44895       +2     
- Misses      38897    38936      +39     
- Partials     2865     2866       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@algorandskiy algorandskiy marked this pull request as ready for review March 7, 2025 14:28
@cce
Copy link
Contributor

cce commented Mar 7, 2025

algogm
algogm previously approved these changes Mar 7, 2025
@algogm algogm requested review from algogm and removed request for algogm March 7, 2025 16:03
@algogm algogm dismissed their stale review March 7, 2025 16:05

admin

@algorandskiy algorandskiy merged commit ad30cd6 into algorand:master Mar 7, 2025
23 checks passed
@algorandskiy
Copy link
Contributor Author

Submitted a PR into upstream libp2p/go-libp2p#3225
If it is taken in some form then can remove this workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug-Fix p2p Work related to the p2p project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fast catchup (goal node catchup) hangs when running with EnableP2P: true
4 participants