Skip to content
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

BUG: targets async="true" ignored identity impersonate #40

Closed
ghost opened this issue Oct 6, 2012 · 1 comment
Closed

BUG: targets async="true" ignored identity impersonate #40

ghost opened this issue Oct 6, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 6, 2012

Reported in the forum at post: http://nlog-project.org/forum.html#nabble-tc1685903|a1685903

 

If you are running with <identity impersonate="true"...> in your web.config and you set targets async="true", the lazy writer thread doesn't work under the context of your impersonated identity. If you instead put in a AsyncWrapper, that works fine. If you use async="true" and put in an ImpersonatingWrapper duplicating the info in your identity impersonate in web.config that works fine (but is of course undesirable).

Moved from http://nlog.codeplex.com/workitem/2717

Comments:
Scratch that, my config change wasn't picked up for some reason. Even the AsyncWrapper doesn't impersonate without having an impersonatingwrapper.

Also I'm finding that if I try to load the page again while the lazy writer is still retrying (I have a retrying wrapper inside the asyncwrapper), it waits for the batch to finish before letting me in. Maybe this is required for thread safety or something but it makes the async not so much async...

I can tell the lazy writer is in the middle of writer from the debugging log when I put nlog in debug mode and because I see the following in my debug window:

A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in NLog.DLL

and in my debug log:

2008-04-11 17:00:00.2757 Warn Error while writing to 'f3:FileTarget': System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
2008-04-11 17:00:00.7767 Warn Retry #1
2008-04-11 17:00:00.7917 Warn Error while writing to 'f3:FileTarget': System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
2008-04-11 17:00:01.2927 Warn Retry #2
2008-04-11 17:00:01.3077 Warn Error while writing to 'f3:FileTarget': System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
2008-04-11 17:00:01.8087 Warn Retry #3
2008-04-11 17:00:01.8197 Warn Error while writing to 'f3:FileTarget': System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
2008-04-11 17:00:02.3197 Warn Retry #4
2008-04-11 17:00:02.3347 Warn Error while writing to 'f3:FileTarget': System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
2008-04-11 17:00:02.3347 Error Error in lazy writer timer procedure: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at NLog.Targets.Wrappers.RetryingTargetWrapper.Write(LogEventInfo logEvent)
at NLog.Target.Write(LogEventInfo[] logEvents)
at NLog.Targets.Wrappers.AsyncTargetWrapper.LazyWriterTimerCallback(Object state)

If I move the retrywrapper outside the asyncwrapper it doesn't retry at all.

If I take out the retrywrapper I only got this message while the lazy writer is working and because I don't have a delay on retry it's hard to tell if it's making me wait or not. Seems like not if I had to guess.

A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

2008-04-11 16:48:24.9957 Error Error in lazy writer timer procedure: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowConcurrentWrite)
at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
at NLog.Targets.FileTarget.WriteToFile(String fileName, Byte[] bytes, Boolean justData)
at NLog.Targets.FileTarget.Write(LogEventInfo[] logEvents)
at NLog.Targets.Wrappers.AsyncTargetWrapper.LazyWriterTimerCallback(Object state)

I don't see any exceptions from NLog.dll in this case. I wonder if there's also a problem with the retry in an async.

I'm working in ASP.NET 3.5 in VS2008.

This is a snippet of my config:

@304NotModified 304NotModified removed the bug Bug report / Bug fix label Apr 4, 2016
@304NotModified
Copy link
Member

Will close this as this is a known issue as it's polluting the issue list - there is no action for us here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant