C
cat
As per Anthony's suggestion, I'm moving this discussion thread to this group.
The history:
We recently moved an older ASP.NET 1.1 code base on to ASP.NET 2.0, .NET 3.0
and Windows 2003 Server SP2. We started experiencing the following issue with
the web cache (the code is straightforward and worked flawlessy before the
upgrade):
Dim o As Object = Cache.Get(key)
If o Is Nothing Then
Cache.Insert(key, GetTheData())
o = Cache.Get(key)
End If
Randomly, Cache.Get(key) returns nothing, even after the application has
been up for a while. Then the Cache.Insert kicks in. Only that the call to
Insert fails with no error and no exception. The subsequent Cache.Get(key)
returns nothing. I've tried to set up the expiration to some remote date in
the future and the sliding expiration; still nothing. I tried something like
this;
Cache.Insert(key, GetTheData(), Nothing,
DateTime.Parse("1/1/9999"),Cache.NoSlidingExpiration)
and
Cache.Insert(key, GetTheData(), Nothing, Cache.NoAbsoluteExpiration,
TimeSpan.FromDays(365))
I even added after the first failed Insert a Thread.Sleep(20) the tried the
Insert again. Didn't work either.
I searched on the Internet and I found a few other posts describing a
similar issue. Yet no reply to any of them so it seems that there is not much
knowledge about this strange issue.
Any idea is highly appreciated.
Thanks,
cat
Could the problem be with the GetTheData method?
You might be better off asking in the
microsoft.public.dotnet.framework.aspnet
group.
--
Anthony Jones - MVP ASP/ASP.NET
Thank you Anthony for taking the time to reply. After my initial posting I
spent some time researching on the Internet and trying out some other things,
so I do have some more information.
1. To answer to your questions/suggestions:
1.a. I will move this discussion to microsoft.public.dotnet.framework.aspnet
1.b. GetTheData was just some very generic pseudocode. The real code
retrieves the information as a dataset based on some criteria, then saves
this dataset to the cache. I am storing a reference to the retrieved dataset
before putting it in the cache, so the code is more like this:
Dim dt As DataSet = GetTheData()
Cache.Insert(key, dt, Nothing,
DateTime.Parse("1/1/2999"),Cache.NoSlidingExpiration)
2. After several days of researching this issue and experimenting various
things, I kind of reached the conclusion that this must be something related
to the memory management. Everything is ok until w3wp (iis worker process)
exceends 400 MB. The computer I am running all those tests has 1 GB RAM.
Subtracting the OS and system cache memory allocations, the 400 MB threshold
means that the computer has under 100 MB of available physical RAM. After
passing that threshold, it seems that .NET runtime refuses to add items to
the cache while also not telling anything to the code (as in, raising some
sort of out of memory exception). Either ASP.NET 2.0 is a more memory hog or
whatever else changed, but this was not happening before upgrading the code
base/site to .NET 3.0 / ASP.NET 2.0 / w2k3 SP2. The site itself is complex
but not that big. It puzzles me why w3wp would grow beyond 400 MB of RAM.
3. I have downloaded, installed and run CLR profiler and ANTS profiler. I am
trying to figure out what's going on at the lower levels. To my surprise,
ANTS (non-Microsoft, not free tool) is worse than CLR profiler (Microsoft
free tool). To this point, it seems that the .net runtime is doing some
allocations (mostly strings) that sit there forever and eat up memory. At
some point I manage to induce a system failure; w3wp gets into a continuous
loop, and IIS fails to ping it therefore it recycles it. I can do that afther
hitting the site for about 10 minutes continuously. All very weird. Never had
those problems before upgrading the code to .NET 3.0 / ASP.NET 2.0 / Win2k3
SP2. A colleague of mine has a similar environment, just SP1 instead of SP2,
so I started wondering whether Microsoft created some weird bug in the heap
allocator in SP2.
The history:
We recently moved an older ASP.NET 1.1 code base on to ASP.NET 2.0, .NET 3.0
and Windows 2003 Server SP2. We started experiencing the following issue with
the web cache (the code is straightforward and worked flawlessy before the
upgrade):
Dim o As Object = Cache.Get(key)
If o Is Nothing Then
Cache.Insert(key, GetTheData())
o = Cache.Get(key)
End If
Randomly, Cache.Get(key) returns nothing, even after the application has
been up for a while. Then the Cache.Insert kicks in. Only that the call to
Insert fails with no error and no exception. The subsequent Cache.Get(key)
returns nothing. I've tried to set up the expiration to some remote date in
the future and the sliding expiration; still nothing. I tried something like
this;
Cache.Insert(key, GetTheData(), Nothing,
DateTime.Parse("1/1/9999"),Cache.NoSlidingExpiration)
and
Cache.Insert(key, GetTheData(), Nothing, Cache.NoAbsoluteExpiration,
TimeSpan.FromDays(365))
I even added after the first failed Insert a Thread.Sleep(20) the tried the
Insert again. Didn't work either.
I searched on the Internet and I found a few other posts describing a
similar issue. Yet no reply to any of them so it seems that there is not much
knowledge about this strange issue.
Any idea is highly appreciated.
Thanks,
cat
Could the problem be with the GetTheData method?
You might be better off asking in the
microsoft.public.dotnet.framework.aspnet
group.
--
Anthony Jones - MVP ASP/ASP.NET
Thank you Anthony for taking the time to reply. After my initial posting I
spent some time researching on the Internet and trying out some other things,
so I do have some more information.
1. To answer to your questions/suggestions:
1.a. I will move this discussion to microsoft.public.dotnet.framework.aspnet
1.b. GetTheData was just some very generic pseudocode. The real code
retrieves the information as a dataset based on some criteria, then saves
this dataset to the cache. I am storing a reference to the retrieved dataset
before putting it in the cache, so the code is more like this:
Dim dt As DataSet = GetTheData()
Cache.Insert(key, dt, Nothing,
DateTime.Parse("1/1/2999"),Cache.NoSlidingExpiration)
2. After several days of researching this issue and experimenting various
things, I kind of reached the conclusion that this must be something related
to the memory management. Everything is ok until w3wp (iis worker process)
exceends 400 MB. The computer I am running all those tests has 1 GB RAM.
Subtracting the OS and system cache memory allocations, the 400 MB threshold
means that the computer has under 100 MB of available physical RAM. After
passing that threshold, it seems that .NET runtime refuses to add items to
the cache while also not telling anything to the code (as in, raising some
sort of out of memory exception). Either ASP.NET 2.0 is a more memory hog or
whatever else changed, but this was not happening before upgrading the code
base/site to .NET 3.0 / ASP.NET 2.0 / w2k3 SP2. The site itself is complex
but not that big. It puzzles me why w3wp would grow beyond 400 MB of RAM.
3. I have downloaded, installed and run CLR profiler and ANTS profiler. I am
trying to figure out what's going on at the lower levels. To my surprise,
ANTS (non-Microsoft, not free tool) is worse than CLR profiler (Microsoft
free tool). To this point, it seems that the .net runtime is doing some
allocations (mostly strings) that sit there forever and eat up memory. At
some point I manage to induce a system failure; w3wp gets into a continuous
loop, and IIS fails to ping it therefore it recycles it. I can do that afther
hitting the site for about 10 minutes continuously. All very weird. Never had
those problems before upgrading the code to .NET 3.0 / ASP.NET 2.0 / Win2k3
SP2. A colleague of mine has a similar environment, just SP1 instead of SP2,
so I started wondering whether Microsoft created some weird bug in the heap
allocator in SP2.