Skip to content

Question about read and request timeout #1537

@hariso

Description

@hariso

First of all, thanks for such a great project!

In a project, I'm using AHC 1.9.15. I hope that we will be able to upgrade soon, but we are experiencing an issue which cannot wait for the upgrade.

The issue is about a POST request which is expected to take quite some time. On that request's level, we set a request timeout which is one hour. The AsyncHttpClient instance has read timeout and request timeout set to 1 minute.

The mention POST request is failing, because of the read timeout. AHC's source code for NettyRequestSender shows this:

int readTimeoutValue = config.getReadTimeout();
if (readTimeoutValue != -1 && readTimeoutValue < requestTimeoutInMs) {
    // no need for a readTimeout that's less than the requestTimeout
    Timeout readTimeout = newTimeout(new ReadTimeoutTimerTask(nettyResponseFuture, this, timeoutsHolder,
            requestTimeoutInMs, readTimeoutValue), readTimeoutValue);
    timeoutsHolder.readTimeout = readTimeout;
}

Based on the above, I have following questions:

  1. What exactly is the difference between read and request timeout?
  2. Is there a possibility to set the read timeout on request level?
  3. Based on the comment "no need for a readTimeout that's less than the requestTimeout" shouldn't the condition be readTimeoutValue > requestTimeoutInMs? I might be way off here because I don't really understand the difference between read and request timeout here.

Thanks in advance!

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