mvcdonutcaching icon indicating copy to clipboard operation
mvcdonutcaching copied to clipboard

Sometimes the cached page becomes blank page.

Open chancewen opened this issue 11 years ago • 10 comments

I use mvcdonutcaching on one page of my site. It runs well except that sometimes the page becomes blank page, so that I must restart IIS to recover. the problem happens every a few days.

I wonder if this problem is related to mvcdonutcaching.

Thanks a lot!

chancewen avatar Jan 02 '14 06:01 chancewen

We need more details to investigate on this issue.

moonpyk avatar Jan 06 '14 08:01 moonpyk

We are experiencing the same. For now I can only add that we see that if you refresh the page the problem disappears. Maybe we are experiencing a different bug, but seems to me it's related. I try to get some more details. We are using the library in a webfarm like environment where we have set the machinekey to be the same on all the machines.

JohanAlkemade avatar Feb 12 '14 09:02 JohanAlkemade

I couldn't reproduce this, but after looking at the code it might be a threading issue. In the ExecuteCallback (which is stored in the HttpContext), the library uses a variable "cachingWriter" which is set as the output writer before the result is executed. The code results in a closure.

Now I don't know how .NET compiles closures, but could it perhaps be that if one thread calls the cachingWriter.toString() and another thread just created a new cachingWriter, the first call results in a empty string as it is a new StringWriter?

JohanAlkemade avatar Feb 12 '14 11:02 JohanAlkemade

I don't what to answer actually, in normal conditions ASP.NET MVC handles each request on a separate thread and sticks to it. If it's not the case, I clearly don't know what to do.

moonpyk avatar Feb 16 '14 11:02 moonpyk

I'm guessing in this case, that this project won't work when using Async Controllers in MVC4 onwards?

http://www.codeguru.com/csharp/.net/net_asp/mvc/creating-asynchronous-actions-in-asp.net-mvc.htm

YodasMyDad avatar Oct 22 '14 11:10 YodasMyDad

We don't have any update on this, we have projects using async controllers in production, who, of course make use of MvcDonutCaching with no problem. Added that, since MVC4 all controller internal infrastructure is async by default.

moonpyk avatar Oct 22 '14 17:10 moonpyk

Fantastic :) This is an excellent project.

YodasMyDad avatar Oct 22 '14 18:10 YodasMyDad

Actually we have similar issue - sometimes is page just empty. Should we rewrite controller actions to async, or why @leen3o mention it?

Sebosek avatar Aug 10 '15 12:08 Sebosek

I had it too. Running on azure. Problem is, the status code is still OK, so my monitors dont alert me...

Jogai avatar Feb 07 '19 19:02 Jogai

In my case I found that removing this line fixed my issue,
"ControllerContext.RequestContext.RouteData.Values.Remove(value.Key);" there should be some problems removing values from ControllerContext.RequestContext.RouteData that cause that the page become a blank page without throwing any error. PD: If you add the removed value after removing it, that also fix the issue, like this ControllerContext.RequestContext.RouteData.Values.Add(value.Key, value.Value);

jecabana avatar Feb 25 '21 18:02 jecabana