Skip to content

Http2Client with native HttpClient does not enforce response timeout correctly #3068

@zkorhone

Description

@zkorhone

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions