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

I\O timeout/context deadline errors #47

Open
niccolofant opened this issue Feb 4, 2025 · 2 comments
Open

I\O timeout/context deadline errors #47

niccolofant opened this issue Feb 4, 2025 · 2 comments

Comments

@niccolofant
Copy link

I have an application that polls canister methods and makes roughly 200/300 calls/s. After a few minutes the app is started these errors start to pop up:
Post "<canister endpoint>": context deadline exceeded
Post "<canister endpoint>": dial tcp <ip>: i/o timeout

I tweaked a bit the source code by modifying a few client configs inside the agent but i think the most problematic is that i don't see any

resp.Body.Close()

in the client methods (specifically Client.Call and Client.post methods).

So my proposals are:

  • Add the missing function calls on those methods
  • Modify the Agent constructor by adding an additional param to allow for customs http clients
@q-uint
Copy link
Member

q-uint commented Feb 5, 2025

Hey @niccolofant!

Your observations regarding missing resp.Body.Close() calls are valid concerns, as not properly closing response bodies can lead to connection leaks over time. I will review the implementation next week and ensure that response bodies are properly closed where necessary.

Regarding your second proposal, adding support for custom HTTP clients in the constructor could indeed provide more flexibility for fine-tuning connection settings, timeouts, and transport behavior. This could be particularly useful for high-frequency polling scenarios like yours.

You can expect a PR somewhere next week to fix this.

Note that boundary nodes also enforce rate limits. While I haven’t encountered issues with dial tcp <ip>: i/o timeout, I have experienced cases where boundary nodes refused requests due to rate limiting.

@q-uint
Copy link
Member

q-uint commented Feb 5, 2025

Hey @niccolofant, v0.7.0-alpha should fix some issues you're having.
I might do some other changes before making an official release.

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

No branches or pull requests

2 participants