Java11 Http2Client rejects documented zero connect and read timeouts · Issue #3635 · OpenFeign/feign · GitHub
Skip to content

Java11 Http2Client rejects documented zero connect and read timeouts #3635

Open

Description

@hutiefang76

Request.Options.connectTimeoutMillis() and readTimeoutMillis() document 0 as no timeout, but the Java11 client passes zero durations directly to the JDK builders, which reject them.

On current master (fee42b4), a request with a zero read timeout throws IllegalArgumentException: Invalid duration: PT0S before being sent. A zero connect timeout also makes new Http2Client(options) fail. The same problem affects the synchronous and asynchronous execution paths, including a supplied native client with no connect timeout configured.

I reproduced this with the public Http2Client.execute methods against a local MockWebServer, using real Zulu 11.0.32.1 compilation and Temurin 25 test execution as required by the module's toolchains. Seven zero-timeout cases fail with IllegalArgumentException; both positive-timeout controls receive the expected HTTP response.

For example:

Options options = new Options(5000, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS, true);
Http2Client client = new Http2Client(options);
client.execute(request, options); // fails before sending the request

I am preparing a fix to omit the relevant JDK timeout setter for zero, and to treat an absent native connect timeout as matching zero. Positive timeout behavior and rejection of negative values will remain unchanged. This is separate from #3068's streaming response-body timeout question.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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