Skip to content

Fix: Set configured timeouts as default RequestConfig on HTTP client#1795

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-adyen-http-client-timeout
Draft

Fix: Set configured timeouts as default RequestConfig on HTTP client#1795
Copilot wants to merge 3 commits intomainfrom
copilot/fix-adyen-http-client-timeout

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

connectionTimeoutMillis, readTimeoutMillis, and connectionRequestTimeoutMillis from Config were applied per-request but never set as the default RequestConfig on the CloseableHttpClient itself — leaving the client with no timeout fallback and allowing requests to run far beyond configured limits under adverse network conditions.

Changes

  • AdyenHttpClient: Pass Config into createHttpClientWithSocketFactory and call setDefaultRequestConfig() with the configured timeouts when building the HTTP client:
RequestConfig defaultRequestConfig =
    RequestConfig.custom()
        .setResponseTimeout(config.getReadTimeoutMillis(), TimeUnit.MILLISECONDS)
        .setConnectTimeout(config.getConnectionTimeoutMillis(), TimeUnit.MILLISECONDS)
        .setConnectionRequestTimeout(config.getConnectionRequestTimeoutMillis(), TimeUnit.MILLISECONDS)
        .build();

return HttpClients.custom()
    ...
    .setDefaultRequestConfig(defaultRequestConfig)
    ...
    .build();
  • AdyenHttpClient: Made createCloseableHttpClient package-private to allow direct unit testing.
  • ClientTest: Added tests verifying that the HTTP client's default RequestConfig reflects both custom and default timeout values from Config.
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Adyen HTTP Client Timeout Issue</issue_title>
<issue_description>### Description

We configured Adyen HTTP client timeout values like this: connectionTimeoutMillis=15secs, readTimeoutMillis=15secs, connectionRequestTimeoutMillis=15secs. However, there was an incident on Adyen India servers between Feb 27, 3:00 pm and Feb 27, 3:50 pm, and we saw that Adyen gateway latencies increased to up to 4 minutes. According to our configuration, this should have never happened. Because requests would have terminated much earlier with an error, according to our Adyen client timeout configuration. We need this behavior to be fixed.

Steps to reproduce

This is not an easily reproducible issue...

Our current Adyen config is like below:

config.connectionTimeoutMillis = 15000
config.readTimeoutMillis = 15000
config.connectionRequestTimeoutMillis = 15000

Between Feb 27, 3:00 pm and Feb 27, 3:50 pm, there was an incident on Adyen India account. We got lots of below errors:

Adyen HTTP client's latency increased dramatically to up to 4 minutes like below:

Image

Actual behavior

Adyen HTTP client actual time out values increased to up to 4 minutes.

Expected behavior

Adyen HTTP client should have timed out much earlier than the current situation.

Code snippet or screenshots (if applicable)

We are not sure what exactly the problem is, however, we suspect from the below code piece:

  private CloseableHttpClient createHttpClientWithSocketFactory(
      SSLConnectionSocketFactory socketFactory) {
    return HttpClients.custom()
        .setConnectionManager(
            PoolingHttpClientConnectionManagerBuilder.create()
                .setSSLSocketFactory(socketFactory)
                .build())
        .setRedirectStrategy(new AdyenCustomRedirectStrategy())
        .build();
  }

Above, a custom HTTP client gets created with the default configuration.

Maybe, setting a default configuration via setDefaultRequestConfig function and using the configuration parameters that we provided might help solve/mitigate the issue that we face.

We see and understand that, timeout configurations are set per request at a later phase, however, we also suspect that this default configuration might still be actively used under heavy load.

Adyen Java API Library version

41.0.0

Java version

21

Operating System

Linux

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@gcatanese @senturkozer Apologies for the inconvenience, we will start investigating the issue to assess the cause and solutions. Thank you for the detailed report.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 13, 2026 07:41
Co-authored-by: gcatanese <1771700+gcatanese@users.noreply.github.com>
Co-authored-by: gcatanese <1771700+gcatanese@users.noreply.github.com>
Copilot AI changed the title [WIP] [Bug] Fix Adyen HTTP client timeout issue Fix: Set configured timeouts as default RequestConfig on HTTP client Mar 13, 2026
Copilot AI requested a review from gcatanese March 13, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Adyen HTTP Client Timeout Issue

2 participants