Http2Client with native HttpClient does not enforce response timeout correctly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
There is a flaw in Java's interface design that makes it very easy to introduce bug where application stalls when using native HttpClient. Request timeout given applies only to point when response headers are received. Timeout does not apply to receiving body.
Official jdk issue: https://bugs.openjdk.org/browse/JDK-8208693
Easiest way to address the problem is to use async sending with orTimeout. The far more complex alternative is to create customer body handler / subscriber that is able to handle timeout correctly.
Considering that writing customer body handler is a non-trivial task and that orTimeout does address the problem, I would recommend changing feign implementation to use asyncSend. Java's internal synchronous implementation is a delegate to async call, so change to async would not change threading behaviour.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Http2Client implementation and review how the native HttpClient applies its request timeout, then compare the behavior with JDK-8208693. The change is complete when timeouts also cover receiving the response body without changing the expected threading behavior; add or update a regression test if the surrounding implementation provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100