Download tasks of Custom Update Center fail with SocketTimeoutException

1 minute readKnowledge base

Issue

The core / plugin download tasks of an Update Center item are timing out in seconds even though the configured Download timeout in the Update Center item configuration is set to very large value:

WARNING c.c.p.u.t.DownloadPluginTask#run: timeout
java.net.SocketTimeoutException: timeout
    at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:675)
    at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.kt:684)
    at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.kt:379)
    at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:281)
    at okio.RealBufferedSource$inputStream$1.read(RealBufferedSource.kt:158)
    at java.base/java.io.InputStream.transferTo(InputStream.java:704)
    at java.base/java.nio.file.Files.copy(Files.java:3078)
    at com.cloudbees.plugins.updatecenter.UpdateCenter._downloadPlugin(UpdateCenter.java:896)
    at com.cloudbees.plugins.updatecenter.transfers.DownloadPluginTask.run(DownloadPluginTask.java:41)
    at com.cloudbees.plugins.updatecenter.transfers.TransferTask$ExecutableImpl.run(TransferTask.java:162)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)
  • BEE-39250: Download Task sensitive to default HTTP timeouts

Explanation

The issue is caused by a read timeout problem and symptomatic of a very slow connection. The HTTP client used to download core /plugin binaries have a default read and connect timeout set to 10s. The exception happens when no data has transited for more than the read timeout configured (10s by default). Note: in case if a connect timeout, the exception message would read java.net.SocketTimeoutException: connect timed out.

Starting version 4.82 of the CloudBees Update Center Plugin, the Connect and Read timeouts are configuration via system properties to accomodate to those environment with slower connections.

Resolution

  • Upgrade CloudBees Update Center plugin to version 4.82 or later (available under the CloudBees Assurance Program since CloudBees CI 2.414.2.2

  • Adjust the read / connect timeout using the system properties com.cloudbees.plugins.updatecenter.UpdateCenter.HTTP_CONNECT_TIMEOUT_SECONDS and com.cloudbees.plugins.updatecenter.UpdateCenter.HTTP_READ_TIMEOUT_SECONDS (this requires a restart)