{"action":"opened","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-java/issues/419","labels_url":"https://api.github.com/repos/aws/aws-sdk-java/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-java/issues/419/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-java/issues/419/events","html_url":"https://github.com/aws/aws-sdk-java/issues/419","id":71929803,"number":419,"title":"ConnectionPool timeout exception","user":{"login":"ferozed","id":3730318,"avatar_url":"https://avatars.githubusercontent.com/u/3730318?v=3","gravatar_id":"","url":"https://api.github.com/users/ferozed","html_url":"https://github.com/ferozed","followers_url":"https://api.github.com/users/ferozed/followers","following_url":"https://api.github.com/users/ferozed/following{/other_user}","gists_url":"https://api.github.com/users/ferozed/gists{/gist_id}","starred_url":"https://api.github.com/users/ferozed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferozed/subscriptions","organizations_url":"https://api.github.com/users/ferozed/orgs","repos_url":"https://api.github.com/users/ferozed/repos","events_url":"https://api.github.com/users/ferozed/events{/privacy}","received_events_url":"https://api.github.com/users/ferozed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-29T16:53:14Z","updated_at":"2015-04-29T16:53:14Z","closed_at":null,"body":"Opening a new issue to give visibility.\r\n\r\nThis is related to:  https://github.com/aws/aws-sdk-java/issues/269\r\n\r\n\r\nOur java process does calls to SQS and S3 at the same time. We sometimes get a connectionpooltimeout exception while reading objects from S3. When this happens, all S3 activity stops and we have to restart the process.\r\n\r\nOriginally , the problem was because we were not closing the S3ObjectInputStream. We fixed that but the problem happened again. \r\n\r\nWe use 20 threads for downloading objects from S3.\r\n\r\nI have grepped the logs for all s3 client errors and put them into a logfile.\r\n\r\nhttp://feroze.s3.amazonaws.com/log.zip?AWSAccessKeyId=AKIAI6ILPMH4QR4ISPHQ&Expires=1432835134&Signature=zPtpBNEz2QHlC%2BpBx4TqvlstTZA%3D\r\n\r\nPlease have a look at this and let me know if you see something that stands out. here is a snippet of my code....\r\n\r\n```\r\n    private void saveOriginalImage(long imageId, String bucketName, String s3Key) throws Exception\r\n    {\r\n        try\r\n        {\r\n            String s3KeySanitized = getSanitizedS3Key(s3Key);\r\n            S3Object s3Object = s3Client.getObject(bucketName, s3KeySanitized);\r\n\r\n            File destinationPath = getDestinationPath(imageId);\r\n            writeS3ObjectToFile(s3Object, destinationPath);\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            logWarn(\"Unable to save original image: \", e);\r\n            throw e;\r\n        }\r\n    }\r\n\r\n    private void writeS3ObjectToFile(S3Object s3Object, File outputFile) throws IOException\r\n    {\r\n        FileOutputStream outputStream = new FileOutputStream(outputFile);\r\n        S3ObjectInputStream s3InputStream = s3Object.getObjectContent();\r\n        try\r\n        {\r\n            IOUtils.copy(s3InputStream, outputStream);\r\n        }\r\n        finally\r\n        {\r\n            try {\r\n                s3InputStream.close();\r\n            } catch (Exception e) {\r\n                logWarn(\"Unable to close s3 input stream\", e);\r\n            }\r\n            try {\r\n                outputStream.close();\r\n            } catch (Exception e) {\r\n                logWarn(\"Unable to close output stream\", e);\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\nhere is my client config\r\n\r\n```\r\n41        ClientConfiguration clientConfiguration = new ClientConfiguration();\r\n42        clientConfiguration.setConnectionTimeout(20000);\r\n43        this.sqsClient = new AmazonSQSClient(awsCredentials, clientConfiguration);\r\n44        this.s3Client = new AmazonS3Client(awsCredentials, clientConfiguration);\r\n```\r\n"}}