-
Notifications
You must be signed in to change notification settings - Fork 864
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
logging via AWS.Logger.Log4net.AWSAppender hangs web app #1968
Comments
Hi @alverdal, Good morning. Thanks for raising the issue. Could you please share the following:
Upon checking the AWSSDK changelog, Thanks, |
Hi, I got no credential configured on my local dev machine. Sample code: https://github.com/alverdal/awslog4net-example |
@alverdal I would try to look at your sample. However, you need to have credentials configured in order to send logs to CloudWatch. I'm unsure if any changes in Microsoft request pipeline might have impacted this, aa stated earlier, only IPv6 support for IMDS was added in AWSSDK.Core 3.7.1. Your logs also clearly state that it's unable to fetch credentials from EC2 metadata service, which is the last place where credentials are searched for. Try to configure credentials which has IAM policy for logging into CloudWatch. |
Hi, thanks for a quick response :) To clarify, when I use 3.7.1 version I get no log at all, the application seem to hang and never returns a response. This occuss both locally and on our test server (the test server is configured with working aws credentials). When I use < 3.7.1 locally the application is working even though it logs some credential errors in the 'AWS.Logger.Log4net.AWSAppender' log file. When I use < 3.7.1 on the testserver everything is working fine, no credential errors thrown. So it seems that >= 3.7.1 is hanging the web application both with and without working credentials. Hopefully you can reproduce the issue with the repo example. Thanks. |
@alverdal When you run the application using IIS Express, it runs under the identity of local user account. When the application is run in IIS, it runs under the web application pool identity. This web application pool identity would not have access to create logs, default credentials file would not be searched for in the user's profile location, etc. Please refer to the workaround in the issue #1139 where similar problem was reported. Hope this helps. |
I cannot see that it explains why it’s working depending on which version
of the sdk I use. I’m publishing to the same site in IIS with the same
permissions and it’s only working for version < 3.7.1 .
Have you had time to test the repo?
Thank you
fre 7 jan. 2022 kl. 18:29 skrev Ashish Dhingra ***@***.***>:
… Hi,
I got no credential configured on my local dev machine. I should say that
I saw that I got the same problem on our test server as well. The logging
is working OK on this server when using an earlier version than 3.7.1 (logs
showing up in cloudwatch).
Sample code: https://github.com/alverdal/awslog4net-example You need to
publish to IIS for the web site to hang. If running via IIS Express the web
site seem to be starting up OK.
@alverdal <https://github.com/alverdal> When you run the application
using IIS Express, it runs under the identity of local user account. When
the application is run in IIS, it runs under the web application pool
identity. This web application pool identity would not have access to
create logs, default credentials file would not be searched for in the
user's profile location, etc. Please refer to the workaround in the issue
#1139 <#1139> where similar
problem was reported. Hope this helps.
—
Reply to this email directly, view it on GitHub
<#1968 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSUMFTAMRVASDJUYOKARPDUU4PIDANCNFSM5LKWWHIQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@ashishdhingra if it will help to clarify the issue we can have a live session, just let me know :) |
While root cause needs to be investigated, issue is reproducible. STEPS:
RESULT: The default web page is not displayed and appears to be hanged. The log file |
Good job on reproducing the behaviour 👍 |
I have the exact same issue. Ticket here: aws/aws-logging-dotnet#253 |
I looked at a dump of the hung process and see this is where it is stuck: SYMBOL_NAME: w3wphost!AppHostInitialize+14c |
Another way to test this is have ZERO credentials configured. The old version did not hang, it just did NOT log. The new version hangs instead of bypassing the issue and running without logging. This was working for developers without any credentials until we upgraded. After upgrading to get it to work we had to configure AWS CLI and put in default credentials. |
Settings the environment variable AWS_EC2_METADATA_DISABLED to true stops the lock up. NOTE: The website runs but it does not send logs with this set. |
Big thanks to @alverdal and @ethos-tim for your work investigating and troubleshooting this! Confirmed that we do have a deadlock between two threads:
So thread 2 above is blocked when trying to create a logger on the lock held by thread 1 inside log4net. But thread 1 is also blocked, waiting for that static constructor of Configuring credentials other than EC2's, or setting |
We've released AWS.Logger.Core v3.3.3 today, which now lazily initializes the internal CloudWatch Logs client. This should avoid the race condition with the SDK's own logging that was leading to the deadlock. You could either upgrade your pinned version of AWS.Logger.Core, or to AWS.Logger.Log4net v3.5.3 to pull in the latest core. Let us know if that doesn't mitigate the issue for you, or if anybody is seeing this outside of AWS.Logger.Log4net. Thanks. |
Comments on closed issues are hard for our team to see. |
Description
Web application refuse to start after updating nuget package AWSSDK.core from 3.7.0.45 -> 3.7.1 (and anything newer).
I'm using AWS.Logger.Log4net to send logs to cloud watch.
On my local dev machine I got valid credentials to access cloud watch and the sdk is complaining that I got invalid credentials.
On 3.7.0.45 this seemed to be ignored and the web application was able to start and run without issues. But after updating to 3.7.1 the application is complaining on credentials and the web application hangs.
I'm running the web application on IIS.
According to the logs it seem that a thread is aborted and that causes the whole web application to halt.
Perhaps you can see if anything related to invalid credentials was changed between these versions that might cause the issue and also instruct me on how I can fix this issue.
Reproduction Steps
Updated nuget package AWSSDK.Core.
Try to log using the appender
Logs
Environment
Resolution
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: