Closed GoogleCodeExporter closed 9 years ago
Thanks for reporting this issue with detail and a sample to demonstrate it. I
have been able to reproduce the issue with the combination of ELMAH 1.2 SP 2
and Elmah.MVC. Below is the full stack trace with line numbers:
at Elmah.ErrorLogDownloadHandler.AsyncResult.End() in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogDownloadHandler.cs:line 534
at Elmah.ErrorLogDownloadHandler.EndProcessRequest(IAsyncResult result) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogDownloadHandler.cs:line 138
at Elmah.ErrorLogDownloadHandler.ProcessRequest(HttpContext context) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogDownloadHandler.cs:line 61
at Elmah.Mvc.ElmahResult.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
ELMAH 1.2 SP 2, package version 1.2.1 and file version 1.2.14706.955
Elmah.MVC package version 2.1.1 and assembly version 2.0.0.29988
I will post more details and possibly a workaround later.
Original comment by azizatif
on 19 Jul 2013 at 5:53
This issue occurs due to an erroneous race condition under a very specific set
of circumstances, when ELMAH is used in combination with Elmah.MVC and
SqlErrorLog and only when downloading the log.
SqlErrorLog is the only ErrorLog implementation supplied with ELMAH that
supports asynchronous operations. ErrorLogDownloadHandler is the only HTTP
handler in ELMAH that is implemented to take advantage of asynchronous
operations of an ErrorLog implementation in order to avoid tying a worker
thread due to I/O latency (especially in production). Elmah.MVC on the other
hand forces synchronous processing by invoking
ErrorLogDownloadHandler.ProcessRequest[1], which is where the race condition
occurs. Unfortunately, this code path never gets invoked by ASP.NET directly
because if a handler implements IHttpAsyncHandler then BeginProcessRequest and
EndProcessRequest are always called in lieu of ProcessRequest, even if the
downstream ErrorLog implementation natively support asynchronous operation or
not.
Given the above, there are a number of workarounds possible:
1. Remove Elmah.MVC and just use ELMAH. You really do not need the former.
2. Log an issue with Elmah.MVC project to use asynchronous operations of a
handler where available. This is a good thing anyhow as you do not want to
reduce your server scalability due to operational management.
3. Do not use the SqlErrorLog but same scalability concern as in vein 2.
4. Subclass SqlErrorLog and revert asynchronous implementation but same
scalability concern as in vein 2.
Since there is no plan for an SP 3 and you still wish to use Elmah.MVC, you
might want to consider avenue 2 as the quickest resolution.
[1]
https://github.com/alexanderbeletsky/elmah-mvc/blob/ad954deb50efd42302b18a61eb87
a2661a4ffdd2/src/Elmah.Mvc/ElmahResult.cs#L68
Original comment by azizatif
on 19 Jul 2013 at 7:15
Original comment by azizatif
on 19 Jul 2013 at 4:39
This issue was closed by revision 7576b913e220.
Original comment by azizatif
on 19 Jul 2013 at 5:02
There is no plan to make a NuGet release with this fix so patched binaries are
being attached here as a convenience.
Original comment by azizatif
on 19 Jul 2013 at 5:07
Attachments:
Original issue reported on code.google.com by
kir...@gmail.com
on 18 Jul 2013 at 3:58Attachments: