Skip to content

chore(lib/ethclient): add http timeout #3689

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

Merged
merged 3 commits into from
Apr 14, 2025
Merged

Conversation

chmllr
Copy link
Contributor

@chmllr chmllr commented Apr 14, 2025

Add 30s timeout to all ethclient http requests. This should fix production issue where clients are stuck waiting for response from server.

issue: #3699

corverroos and others added 2 commits April 14, 2025 14:31
Add `CloseIdleConnectionsForever` to ethclient. Call it in production
use-cases.

This aims to mitigate the problem of TCP-keep-alive maintaining
long-lived connections to stalled (but alive) RCP servers. This
sometimes occurs with QuickNode, when one of the load-balanced upstream
servers/nodes stalled, but we remain connected to it, requiring a
restart of the affected service to reconnect to a healthy upstream.

By periodically closing idle connections, we get best of both worlds,
TCP-keep-alive improves performance of most queries since TCP connection
doesn't need to be reestablished for each query. But we still reconnect
every 5min ensuring good load balancing over time.

This also required some cleanup:
 - Pass in context in production uses of `ethclient.DialContext`.
 - Remove `ethclient` duplication in `monitor`.

issue: none
@chmllr chmllr enabled auto-merge (squash) April 14, 2025 13:04
@chmllr chmllr merged commit 33feee0 into release/v0.14 Apr 14, 2025
20 checks passed
@chmllr chmllr deleted the chmllr/backport branch April 14, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants