-
Notifications
You must be signed in to change notification settings - Fork 847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent SSL handshake error when calling S3 #1556
Comments
Seeing the same problem intermittently while reading data from S3 |
Have the same type of issue when working with |
Getting the same error intermittently. Running on Lambda.
|
Got the same problem. UPDATE |
Hi @samiechan, Thanks for sharing your findings. Could you please share the EC2 instance configuration (OS, EC2 instance type, etc.) which would help us reproduce the issue? Thanks, |
OS: Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1035-aws x86_64) Let me know, if you need more information. |
Hi @samiechan, I tried to reproduce the issue using the using System;
using System.IO;
using System.Reflection;
using Amazon.S3;
using Amazon.S3.Transfer;
using NLog;
using NLog.AWS.Logger;
using NLog.Config;
using NLog.Targets;
namespace SSLTestConsole
{
class Program
{
static readonly string bucketName = "<<bucket-name>>";
static readonly string downloadDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DownloadedFiles");
static void Main(string[] args)
{
ConfigureNLog();
Logger logger = LogManager.GetCurrentClassLogger();
logger.Info($"Checking if local download directory '{downloadDirectory}' exists.");
if (!Directory.Exists(downloadDirectory))
{
logger.Info($"Creating local download directory '{downloadDirectory}'");
Directory.CreateDirectory(downloadDirectory);
}
AmazonS3Client amazonS3Client = new AmazonS3Client(Amazon.RegionEndpoint.USEast2);
logger.Info($"Executing ListObjectsV2Async on bucket '{bucketName}'");
var listObjevctsV2Response = amazonS3Client.ListObjectsV2Async(new Amazon.S3.Model.ListObjectsV2Request() {
BucketName = bucketName
}).Result;
logger.Info($"Found {listObjevctsV2Response.KeyCount} objects.");
DateTime endDateTime = DateTime.Now.AddMinutes(3);
while (DateTime.Now < endDateTime)
{
foreach (var s3Object in listObjevctsV2Response.S3Objects)
{
string fileName = Path.GetFileNameWithoutExtension(s3Object.Key).Replace(" ", "_") + "_" + DateTime.Now.ToFileTime() + "." + Path.GetExtension(s3Object.Key);
logger.Info($"Downloading '{s3Object.Key}' to '{downloadDirectory}' as '{fileName}' using TransferUtility");
TransferUtility transferUtility = new TransferUtility(new TransferUtilityConfig());
transferUtility.DownloadAsync(new TransferUtilityDownloadRequest()
{
BucketName = bucketName,
Key = s3Object.Key,
FilePath = Path.Combine(downloadDirectory, fileName)
}).GetAwaiter().GetResult();
}
}
}
static void ConfigureNLog()
{
var config = new LoggingConfiguration();
var consoleTarget = new ColoredConsoleTarget();
config.AddTarget("console", consoleTarget);
var awsTarget = new AWSTarget()
{
LogGroup = "NLog.ProgrammaticConfigurationExample",
Region = "us-east-2"
};
config.AddTarget("aws", awsTarget);
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, consoleTarget));
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, awsTarget));
LogManager.Configuration = config;
}
}
} .csproj file <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWS.Logger.NLog" Version="2.0.1" />
<PackageReference Include="AWSSDK.S3" Version="3.5.7.8" />
</ItemGroup>
</Project> But somehow the issue is not reproducible. I have the maximum file size of 200MB, not sure if it would make a difference. Would it be possible for you to share the sample code for reproduction? Also, how are credentials configured and how much time elapses before you get Thanks, |
There was a retry logic added for intermittent SSL_ERROR_ZERO_RETURN issue in |
|
Why is "retry" a solution? |
Current Behavior
We are experiencing intermittent errors ("SSL Handshake failed with OpenSSL error - SSL_ERROR_ZERO_RETURN") when interacting with the S3 client from ECS in one of our applications. The error seems random and occasional, and it may occur while loading or getting objects from S3.
This is an example of an exception we got while getting an object from S3, right after loading it:
S3 client is configured as below:
Expected Behavior
Intermittent SSL handshake errors when calling S3 are not expected.
Steps to Reproduce (for bugs)
We are not able to reproduce this error consistently. In order to test, we tried isolating the application in a dev environment provisioning a single container and sending it a regular load for some days, adjusting the request rate and size. After this we got the mentioned exception a couple of times but root cause or conditions that produce the error are not evident.
Context
This is a simple API implemented with ECS that receive different types of files to internally save them in an S3 bucket, providing a resource id to its clients.
Your Environment
.NET Core Info
The text was updated successfully, but these errors were encountered: