﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Kasi Prasad commented on Production issue: ASP.Net Cache kills the application</title><description>My comment got clipped:

&lt;system.webServer&gt;
    &amp;lt; caching enabled="false" /&amp;gt;
&lt;/system.webServer&gt;</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment33</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment33</guid><pubDate>Sat, 01 Dec 2012 01:12:55 GMT</pubDate></item><item><title>Kasi Prasad commented on Production issue: ASP.Net Cache kills the application</title><description>Sounds like a job for DebugDiag.

You might just try:

&lt;system.webServer&gt;
    &lt;caching enabled="false" /&gt;
&lt;/system.webServer&gt;</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment32</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment32</guid><pubDate>Sat, 01 Dec 2012 01:10:57 GMT</pubDate></item><item><title>smcintire commented on Production issue: ASP.Net Cache kills the application</title><description>Are you using iis 7.5?
if so, is the application running in integrated or classic pipe (and does it happen in both)?
which version of .net are you running in?
can you change the max cache size in your iis config?</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment31</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment31</guid><pubDate>Tue, 20 Nov 2012 13:32:50 GMT</pubDate></item><item><title>Francisco Gómez commented on Production issue: ASP.Net Cache kills the application</title><description>Perhaps the exception of the log is not the cause but a restart of the application for memory problems (App Domain recycling).
Enable tracing "Application Lifetime Events" to see what´s going on before the exception.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment30</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment30</guid><pubDate>Mon, 19 Nov 2012 15:32:49 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Andrew,
No, there is only one site on this machine.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment29</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment29</guid><pubDate>Mon, 19 Nov 2012 08:15:29 GMT</pubDate></item><item><title>Rory Primrose commented on Production issue: ASP.Net Cache kills the application</title><description>You might not be putting something in the cache in your code, but you may be using another component that does.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment28</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment28</guid><pubDate>Sun, 18 Nov 2012 23:02:19 GMT</pubDate></item><item><title>Andrew commented on Production issue: ASP.Net Cache kills the application</title><description>Is it possible you have another website in the same app pool which is responsible for the crash?</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment27</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment27</guid><pubDate>Sun, 18 Nov 2012 22:13:04 GMT</pubDate></item><item><title>Remco Ros commented on Production issue: ASP.Net Cache kills the application</title><description>Pretty awesome that you can post questions like this, and get responses faster then when we post a question on stackoverflow.. epic, and well deserved ofcourse.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment26</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment26</guid><pubDate>Sun, 18 Nov 2012 18:42:37 GMT</pubDate></item><item><title>Chris Shaffer commented on Production issue: ASP.Net Cache kills the application</title><description>Using DisableMemoryCollection seems like a bad/dangerous idea - then if some bit of the code actually is using it (whether that bit of code is something built into .Net, a 3rd party library, or the code), then you risk wasting memory and the out of memory issue mentioned in the linked answer.  And you just have to remember to be careful with the cache in the future (as does anyone that happens to inherit the project in the future).

Kevin Dente's suggestion seems the most appropriate as a fix for the symptom - perhaps add on a memory dump when the exception occurs so you can try to get down to the root cause later on...</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment25</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment25</guid><pubDate>Fri, 16 Nov 2012 20:38:47 GMT</pubDate></item><item><title>Steven Casey commented on Production issue: ASP.Net Cache kills the application</title><description>did you try disablememorycollection as Khalid suggested?

stackoverflow also suggests the same
http://stackoverflow.com/questions/6843343/disable-asp-net-cache</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment24</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment24</guid><pubDate>Fri, 16 Nov 2012 20:23:30 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Mystical,
Does it matter if you call each other or it is a loop? It is the same basic principal.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment23</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment23</guid><pubDate>Fri, 16 Nov 2012 20:05:01 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Kevin,
Thanks, that is what we might do</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment22</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment22</guid><pubDate>Fri, 16 Nov 2012 20:04:43 GMT</pubDate></item><item><title>Kevin Dente commented on Production issue: ASP.Net Cache kills the application</title><description>It's not a fix, but if you want to stabilize things temporarily you could try reverting to the old unhandled exception policy using the legacyUnhandledExceptionPolicy flag in web.config

http://msdn.microsoft.com/en-us/library/ms228965.aspx</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment21</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment21</guid><pubDate>Fri, 16 Nov 2012 18:25:01 GMT</pubDate></item><item><title>Chris Shaffer commented on Production issue: ASP.Net Cache kills the application</title><description>Stab in the dark for a fix and not an explanation - Maybe put something in the cache every once in a while so the cleanup thread has something to do.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment20</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment20</guid><pubDate>Fri, 16 Nov 2012 18:10:11 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Production issue: ASP.Net Cache kills the application</title><description>Drastic times call for Drastic measures</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment19</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment19</guid><pubDate>Fri, 16 Nov 2012 17:01:24 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Poul,
I went over the code, there is nothing that touches the cache, yes.
And this error happened twice in two weeks period in a heavily occupied prod system.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment18</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment18</guid><pubDate>Fri, 16 Nov 2012 16:59:42 GMT</pubDate></item><item><title>Poul Foged commented on Production issue: ASP.Net Cache kills the application</title><description>Ok, a handler that spits out cache.items then. So you're 100% sure its empty before the crash? It just feels like a lot of the suggestions here are hacks ... </description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment17</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment17</guid><pubDate>Fri, 16 Nov 2012 16:57:44 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Poul,
* when this happens, it kills the process, no way to get it.
* there is no aspx there, it is just a handler that gets all requests.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment16</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment16</guid><pubDate>Fri, 16 Nov 2012 16:51:49 GMT</pubDate></item><item><title>Poul Foged commented on Production issue: ASP.Net Cache kills the application</title><description>I know, but it can't be empty right? I'd throw up a .aspx that just prints out Cache.Items ....</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment15</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment15</guid><pubDate>Fri, 16 Nov 2012 16:48:36 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Khalid,
That is my nuclear option, I would REALLY not do that.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment14</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment14</guid><pubDate>Fri, 16 Nov 2012 16:41:36 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Poul,
This happens in prod. And I checked, the entire code base doesn't use the cache.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment13</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment13</guid><pubDate>Fri, 16 Nov 2012 16:40:59 GMT</pubDate></item><item><title>Poul Foged commented on Production issue: ASP.Net Cache kills the application</title><description>Something _must_ be in the cache, try taking a look at Cache Items </description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment12</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment12</guid><pubDate>Fri, 16 Nov 2012 16:38:57 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Production issue: ASP.Net Cache kills the application</title><description>Did you try the configuration settings?

If they didn't you can also do a little reflection trick that looks like it would work.

get the CacheManager using reflection and alter the _timer private property. It is currently using this below.

this._timer = new Timer(new TimerCallback(this.PBytesMonitorThread), (object) null, this._currentPollInterval, this._currentPollInterval);

You could just modify it to be infinite.

this._timer = new Timer(new TimerCallback(this.PBytesMonitorThread), (object) null, this._currentPollInterval, int.MaxValue);

not saying you won't have the issue pop up again, but it will happen far into the future.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment11</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment11</guid><pubDate>Fri, 16 Nov 2012 16:31:53 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Remi,
No, I do not. </description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment10</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment10</guid><pubDate>Fri, 16 Nov 2012 15:46:46 GMT</pubDate></item><item><title>Rémi BOURGAREL commented on Production issue: ASP.Net Cache kills the application</title><description>you can also override string GetOutputCacheProviderName(HttpContext context)

In your httpapplication for loggin wich request try to acces to the asp.net cache.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment9</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment9</guid><pubDate>Fri, 16 Nov 2012 15:40:09 GMT</pubDate></item><item><title>Petar Repac commented on Production issue: ASP.Net Cache kills the application</title><description>From Reflector: 
internal long TrimCache(int percent)
{
    long num = 0L;
    Dictionary&lt;MemoryCache, MemoryCacheInfo&gt;.KeyCollection keys = null;
    lock (this._lock)
    {
        if ((this._cacheInfos != null) &amp;&amp; (this._cacheInfos.Count &gt; 0))
        {
            keys = this._cacheInfos.Keys;
        }
    }
    if (keys != null)
    {
        foreach (MemoryCache cache in keys)
        {
            num += cache.Trim(percent);
        }
    }
    return num;
}

"_cacheInfos" is protected by the lock, but then "keys" points to "_cacheInfos" and is not protected by the lock, so Dictionary can change ant any time.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment8</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment8</guid><pubDate>Fri, 16 Nov 2012 15:39:16 GMT</pubDate></item><item><title>Rémi BOURGAREL commented on Production issue: ASP.Net Cache kills the application</title><description>By default asp.net use the cache for every scriptressource, are you using any ?</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment7</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment7</guid><pubDate>Fri, 16 Nov 2012 15:34:42 GMT</pubDate></item><item><title>Ayende Rahien commented on Production issue: ASP.Net Cache kills the application</title><description>Wyatt,
This isn't output caching, this is the CacheManager getting nasty.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment6</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment6</guid><pubDate>Fri, 16 Nov 2012 15:25:32 GMT</pubDate></item><item><title>Wyatt Barnett commented on Production issue: ASP.Net Cache kills the application</title><description>2nding killing the ASP.NET cache dead -- if you need caching use a caching proxy.

To kill the output cache dead, you need to disable the module in the web config. To get midieval you can also remove it from the root web.config in the %SYSTEMROOT%\Microsoft.NET\Framwork\$VERSION\CONFIG\web.config file.</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment5</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment5</guid><pubDate>Fri, 16 Nov 2012 15:21:00 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Production issue: ASP.Net Cache kills the application</title><description>Sorry, the comment was stripped for some reason.

[caching]
      [cache disableExpiration="true" disableMemoryCollection="true" /&gt;]
[/caching]</description><link>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment4</link><guid>http://ayende.com/159937/production-issue-asp-net-cache-kills-the-application#comment4</guid><pubDate>Fri, 16 Nov 2012 15:19:58 GMT</pubDate></item></channel></rss>