-
Notifications
You must be signed in to change notification settings - Fork 862
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
Dotnet Core 2.1 - AmazonSQSClient AmazonServiceException when call ReceiveMessageAsync #1004
Comments
Interesting, could you try running on .NET Core 2.1 again and set the environment variable |
These are what I found on AWS SDK Internal Log when AmazonSQSClient threw Exception without the env
As we can see, the exception come from here: aws-sdk-net/sdk/src/Core/Amazon.Util/AWSSDKUtils.cs Lines 941 to 953 in 3cacef5
|
And after set the environment variable as you suggest, there is still exception (but rarely than previous).
|
also, looking at the implementation here Looks like even if there is a failure to get the credentials, null credentials are cached for 2 minutes. All subsequent calls fail with default Is there a workaround 🤔 you can recommend till you look into this more? setting the |
With @arishlabroo saying, I think it should not set null but remain previous
|
We have a web api on .NET core 2.1 and publishing messages to SNS. We have seen that same error call-stack in our logs:
We have the problem seen at the same time that sometimes a machine's CPU goes up to 100%, requests fail, and about half the time it recovers, and half the time the resulting healthcheck failure causes it to be terminated. This severe issue means that we are not rolling out .NET core into production any further. Since something is going wrong in the class My questions related to this class are:
If you're worried about things changing during your slightly more complex read expression, then you can do
But if the IL for that is the same as before, then there is no need for even a temp var.
The way that |
Not to hijack this issue, but I'm getting a really similar exception though it sounds like in a different environment (.NET 4.7.1, ECS and SSM not SQS). We're running a Windows IIS docker image in ECS, running our ASP.NET 4.7.1 web application. AWSSDK is latest available in nuget. We're getting this with the SimpleSystemsManagement Client and not SQS, but this error seems to be happening in AWSSDK.Core so I thought it may be related. I've verified that we have all of the ECS Task IAM Role stuff configured correctly, I see the Sorry if this turns out to be a different/unrelated issue, but I thought it might be helpful for tracking this issue down since they seem so similar. Stack Trace:
AWS SDK Log:
|
In order to characterise these
|
I think I'm going to spin up a sample web app that does nothing but get an SSM parameter and spit out some diagnostic info... I may even build against a one-off build of the AWS SDK with some additional logging thrown in there. If you don't think the issues are related I can open a new issue for tracking them independently. |
That sounds quite different to what I am seeing. What i am seeing is
|
We found our issue, it's a quirky behavior of the IIS docker image:
I'm clearing out of this thread but wanted to document this a bit here. Thanks for the help/discussion. |
@actumn how are you resolving the credentials in your container? Have you tried setting |
@sstevenkang @actumn is my colleague. We only retrieve credential from IMDS. So if I set AWS_EC2_METADATA_DISABLED true, sqs client can't find credential, then throwing exception. |
I am a little confused because it looks according to the report, you are running this application in a container not in an EC2 instance. Is it hitting IMDS on the host EC2 instance that's running the docker daemon? |
@sstevenkang Yes. I didn't set ECS Task Role and AWS_CONTAINER_CREDENTIALS_RELATIVE_URI. |
Below code is working for me. Please refer to below document: The .NetCore used is v2.1.2. |
Thanks @Reasonably for the update. Look forward to use it. |
@Reasonably would this fix have specifically applied to the SQS Client? I am seeing the same issue when updating from core 2.0 to core 2.1 with the |
@Reasonably also tested #1010, it does not fix the issue. Using the IWebHostBuilder.UseLibuv() to work around this issue. |
@LOB-JimD #1010 is for that the credential don't set to null when retrieving credential has failed. P.S. I'm so sorry about my terrible english skill |
@Reasonably |
The issue has gotten to confusing and I'm sure what is the state of things. I'm going to close this issue. If anybody is still experience the feel free to create a new issue. |
For anyone encountering this error on a windows EC2 instance, try navigate to http://169.254.169.254/latest/meta-data/ from the server. If the page is unreachable then the SSM agent has not been initialized, this can happen if you customize the base image |
I had this issue on asp.net core 2.1 targeted to framework net462 via the IIS hosting module, and it turned out to be some proxy configuration that I couldn't easily see, though presented itself as a nullreferenceexception initially. After getting AWS SDK logging working, I was clearly able to see it was trying to access the EC2 Instance Metadata Service at 127.0.0.1:8888, which made no sense given IIS configuration. The workaround was to disable proxies globally in code by setting this to null: https://docs.microsoft.com/en-us/dotnet/api/system.net.webrequest.defaultwebproxy?view=netframework-4.7.2#System_Net_WebRequest_DefaultWebProxy |
Hi.
When I updated dotnet core (2.0.6 -> 2.1) and deployed on server, we met some error about credentials in AmazonSQSClient.
I think it is from dotnet core 2.1 HttpClientHandler update.
So I rollback dotnet core version (2.1 -> 2.0.6), then there is no exception anymore.
Expected Behavior
Whenever we call
Amazon.SQS.AmazonSQSClient.ReceiveMessageAsync(ReceiveMessageRequest request, CancellationToken cancellationToken = default(CancellationToken))
, there should be no exception.Current Behavior
The function throws exception very frequently(3 minutes in 6 hour average) like below.
Context
I want to get the network performance provided by dotnet core 2.1, with AWS features.
Your Environment
.NET Core Info
dotnet --info
:The text was updated successfully, but these errors were encountered: