Long connection eventually hangs
- Dominant language
- Elixir
- Stars
- 2.3k
- Forks
- 349
- PR merge metrics
- No merged PRs in 30d
Description
My use case is the consumption of [server-sent events](https://html.spec.whatwg.org/multipage/comms.html#server-sent-events) from a "firehose" API endpoint, which is constantly sending data. Ideally, my connection to this endpoint would never be closed.
The behavior I'm seeing is that, after an indeterminate amount of time, the connection hangs/freezes. No data is being received by my async client process, no errors are generated that I can see, and no `%HTTPoison.AsyncEnd{}` message has been received.
Whatever's happening seems to be related to hackney's `recv_timeout` option. With the default or a relatively low timeout like 30 seconds, the freeze happens fairly quickly - after a day or two. If I set the value of this option to `:infinity`, I see an uptime of two weeks or more - yet the freeze still eventually occurs.
Do I just need to set certain options to support my use case? Or is this a bug?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing a long-lived server-sent events connection with the async client and compare the default, low, and :infinity recv_timeout settings. Trace whether data stops arriving, an error occurs, or an %HTTPoison.AsyncEnd{} message is emitted; done means identifying the cause and documenting the required option or a reproducible fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100