jenkinsci / pipeline-aws-plugin

Jenkins Pipeline Step Plugin for AWS
https://plugins.jenkins.io/pipeline-aws/
Apache License 2.0
431 stars 203 forks source link

Intermittent s3 download failing with UnkownHostException #198

Open ajinkyakadam opened 5 years ago

ajinkyakadam commented 5 years ago

Description

Downloads from s3 are intermittently failing. Note downloading files directly using awscli in the same setting (network, vpc, endpoints) works perfectly fine.

java.net.UnknownHostException: bucketxyz.s3.us-west-2.amazonaws.com
    at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27)
    at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76)
    at com.amazonaws.http.conn.$Proxy18.connect(Unknown Source)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1236)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to Base_Test_Docker_Worker (i-0933c76e295dfe92f)
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
        at hudson.remoting.Channel.call(Channel.java:955)
        at hudson.FilePath.act(FilePath.java:1036)
        at hudson.FilePath.act(FilePath.java:1025)
        at de.taimos.pipeline.aws.S3DownloadStep$Execution$1.run(S3DownloadStep.java:159)
Caused: com.amazonaws.SdkClientException: Unable to execute HTTP request: bucketxyz.s3.us-west-2.amazonaws.com
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4325)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4272)
    at com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:1264)
    at com.amazonaws.services.s3.transfer.TransferManager.doDownload(TransferManager.java:1050)
    at com.amazonaws.services.s3.transfer.TransferManager.doDownload(TransferManager.java:1008)
    at com.amazonaws.services.s3.transfer.TransferManager.download(TransferManager.java:846)
    at com.amazonaws.services.s3.transfer.TransferManager.download(TransferManager.java:764)
    at com.amazonaws.services.s3.transfer.TransferManager.download(TransferManager.java:718)
    at de.taimos.pipeline.aws.S3DownloadStep$RemoteDownloader.invoke(S3DownloadStep.java:207)
    at de.taimos.pipeline.aws.S3DownloadStep$RemoteDownloader.invoke(S3DownloadStep.java:177)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2913)
    at hudson.remoting.UserRequest.perform(UserRequest.java:212)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:369)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

Steps to Reproduce

Using the following snippet to download the file

        s3Download(
          bucket: "bucketxyz",
          file: "destination_filepath",
          path: "s3_objectpath",
          force: true
        )

Expected behavior: s3 object is downloaded

Actual behavior: s3 object download fails with

java.net.UnknownHostException: bucketxyz.s3.us-west-2.amazonaws.com

Environment

Jenkins-Version: 2.121.2

Java-Version:

Plugin-Version: 1.24

Master/Slave Setup: yes

hoegertn commented 4 years ago

Does #192 solve the problem?