.NET Forum / .NET Framework / New Users / May 2008
SharedPerformanceCounter.CreateInstance exception
|
|
Thread rating:  |
Muntz - 30 Apr 2008 05:16 GMT We have written a SOAP Extension assembly that writes timings and method counts to Performance Counter instances every time a Web Method is invoked. This has been working stably for some years.
Recently one one server or another we have noticed some exceptions coming out of this assembly:
System.InvalidOperationException: Custom counters file view is out of memory. at System.Diagnostics.SharedPerformanceCounter.CreateInstance(Int32 counterNameHashCode, String counterName, Int32 instanceNameHashCode, String instanceName) at System.Diagnostics.SharedPerformanceCounter.GetCounter(String categoryName, String counterName, String instanceName) at System.Diagnostics.SharedPerformanceCounter..ctor(String categoryName, String counterName, String instanceName) at System.Diagnostics.PerformanceCounter.Initialize() at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
What is the underlying cause of this exception? Can action be taken in advance to prevent this exception occurring again?
We are MSDN Universal Subscribers. (munter@computershare.com)
Steven Cheng [MSFT] - 30 Apr 2008 07:19 GMT Hi Muntz,
Regarding on the performance counter "Custom counters file view is out of memory" error, I've performed some research. It seems this error is likely to occur on some system which has many .NET managed performance counter instances created or running. Because the .NET performance counter use some file mapping share which has a default size limitation and if the limit has been exceed, such error is raised.
#<performanceCounters> Element http://msdn.microsoft.com/en-us/library/ms229387.aspx
Limits of sizes allowed: Default = 524288 Max = 33554432 Min = 32768
You can set a new value in your machine.config file (similar to this):
====== <configuration> <system.diagnostics> <performanceCounters filemappingsize="600000" /> </system.diagnostics> </configuration> =================
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TXVudHo=?= <Muntz@newsgroups.nospam> >Subject: SharedPerformanceCounter.CreateInstance exception >Date: Tue, 29 Apr 2008 21:16:01 -0700
>We have written a SOAP Extension assembly that writes timings and method >counts to Performance Counter instances every time a Web Method is invoked. [quoted text clipped - 19 lines] > >We are MSDN Universal Subscribers. (munter@computershare.com) Muntz - 30 Apr 2008 08:04 GMT Thanks very much for the prompt response SC.
Any ideas where this file is located? Do you know if it's possible to find what is actually being held in this file?
> Hi Muntz, > [quoted text clipped - 84 lines] > > > >We are MSDN Universal Subscribers. (munter@computershare.com) Muntz - 30 Apr 2008 08:25 GMT Thanks very much for the prompt response SC.
Any ideas where this file is located, to verify how large it is currently?
> Hi Muntz, > [quoted text clipped - 84 lines] > > > >We are MSDN Universal Subscribers. (munter@computershare.com) Steven Cheng [MSFT] - 01 May 2008 03:49 GMT Hi Muntz,
Thanks for your reply.
As for the file the .NET performance counter uses, it is not a physical file, but a memory mapping file. Also, the actual file info is controlled by the .NET framework runtime which is out of our control. So far the settings mentioned in the reference is the suggested place to configure the file size limitation.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TXVudHo=?= <Muntz@newsgroups.nospam> >References: <FE2C8C2E-1DD5-447C-8DFB-90C83D8BC85A@microsoft.com> <D$KutooqIHA.1784@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: SharedPerformanceCounter.CreateInstance exception >Date: Wed, 30 Apr 2008 00:25:00 -0700
>Thanks very much for the prompt response SC. > [quoted text clipped - 41 lines] >> ================================================== >> Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications. >> [quoted text clipped - 42 lines] >> > >> >We are MSDN Universal Subscribers. (munter@computershare.com) Steven Cheng [MSFT] - 05 May 2008 10:29 GMT Hi Muntz,
Does changing the filemappingsize helps on this or do you have any further questions? If so, welcome to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: stcheng@online.microsoft.com (Steven Cheng [MSFT]) >Organization: Microsoft >Date: Thu, 01 May 2008 02:49:29 GMT >Subject: RE: SharedPerformanceCounter.CreateInstance exception
>Hi Muntz, > [quoted text clipped - 142 lines] >>> > >>> >We are MSDN Universal Subscribers. (munter@computershare.com) Muntz - 06 May 2008 08:41 GMT I've passed the suggested fix on to our operations staff. I'll report back when this is applied.
In the meantime, I've noticed a new exception:
Cannot continue the current operation, the performance counters memory mapping has been corrupted. at System.Diagnostics.SharedPerformanceCounter.ResolveOffset(Int32 offset, Int32 sizeToRead) at System.Diagnostics.SharedPerformanceCounter.CalculateAndAllocateMemory(Int32 totalSize, Int32& alignmentAdjustment) at System.Diagnostics.SharedPerformanceCounter.CreateInstance(CategoryEntry* categoryPointer, Int32 instanceNameHashCode, String instanceName, PerformanceCounterInstanceLifetime lifetime) at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime) at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
Any ideas?
> Hi Muntz, > [quoted text clipped - 175 lines] > >>> > > >>> >We are MSDN Universal Subscribers. (munter@computershare.com) Steven Cheng [MSFT] - 07 May 2008 07:54 GMT Thanks for your followup Muntz,
Regarding on the new error you mentioned below:
============ Cannot continue the current operation, the performance counters memory mapping has been corrupted. ==========
I've also performed some research on this. So far what I've found is that this error is possibely raised when you first call .NET performance counters classes in .net framework 1.1(or maybe other higher version) and then use .NET 1.0 classes to call the performance counters. Therefore, I'm wondering whether there are multiple applications with different versions that all use .NET performance counters classes?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TXVudHo=?= <Muntz@newsgroups.nospam> >References: <FE2C8C2E-1DD5-447C-8DFB-90C83D8BC85A@microsoft.com> <D$KutooqIHA.1784@TK2MSFTNGHUB02.phx.gbl> <BAC80ACA-8BC2-4366-BE38-8252069563E7@microsoft.com> <14mS#XzqIHA.1784@TK2MSFTNGHUB02.phx.gbl> <Q56gQKprIHA.1784@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: SharedPerformanceCounter.CreateInstance exception >Date: Tue, 6 May 2008 00:41:01 -0700
>I've passed the suggested fix on to our operations staff. I'll report back >when this is applied. [quoted text clipped - 20 lines] > >Any ideas? Muntz - 07 May 2008 08:51 GMT We were just testing a new version of the service, which uses .NET 2.0, against the previous version which uses .NET 1.1
Don't think there is anything accessing counters using .NET 1.0 but it's hard to be sure.
> Thanks for your followup Muntz, > [quoted text clipped - 68 lines] > > > >Any ideas? Steven Cheng [MSFT] - 08 May 2008 10:52 GMT Thanks for your reply Muntz,
So if there are multiple version of .net framework running on it, and some of them use performance countes API, it does be possible that the problem is caused by this. I think it will be helpful if you can try isolating the problem to some certain applications(such as turn off most other applications that will use performance counters).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TXVudHo=?= <Muntz@newsgroups.nospam> >References: <FE2C8C2E-1DD5-447C-8DFB-90C83D8BC85A@microsoft.com> <D$KutooqIHA.1784@TK2MSFTNGHUB02.phx.gbl> <BAC80ACA-8BC2-4366-BE38-8252069563E7@microsoft.com> <14mS#XzqIHA.1784@TK2MSFTNGHUB02.phx.gbl> <Q56gQKprIHA.1784@TK2MSFTNGHUB02.phx.gbl> <DDE84FC4-EF43-485F-98CF-FECA593A7797@microsoft.com> <xSloE9AsIHA.772@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: SharedPerformanceCounter.CreateInstance exception >Date: Wed, 7 May 2008 00:51:02 -0700
>We were just testing a new version of the service, which uses .NET 2.0, >against the previous version which uses .NET 1.1 [quoted text clipped - 32 lines] >> ================================================== >> Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications. >> [quoted text clipped - 39 lines] >> > >> >Any ideas? Muntz - 08 May 2008 13:10 GMT Thanks for your response SC, but isn't this a pretty major flaw? Not being able to access .NET Performance Counters via diff. versions of .NET on the same machine?
Is there another Performance Counter API I can use to write our instance counters?
> Thanks for your reply Muntz, > [quoted text clipped - 124 lines] > >> > > >> >Any ideas? Steven Cheng [MSFT] - 09 May 2008 04:55 GMT Thanks for your reply Muntz,
I think the PerformanceCounters class should be the preferreed means to access windows performance counters. The problem you encounter is possibly due to some environment specific settings.
So currently, about the two errors you mentioned
1) the "Custom counters file view is out of memory"
2) "the performance counters memory mapping has been corrupted."
does the first problem got resolved after you apply the filemappingsize configuration? Or is the second error the main problem you need to address now? For the second one, it would be hard to troubleshoot from appearance, I may try finding some futher resource to continue help you, you can send me an email to "stcheng" +"@" + "Microsoft.com" so that I can ask you for further information offline. Or if you feel it an urgent issue, you can also consider contacting CSS:
Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TXVudHo=?= <Muntz@newsgroups.nospam> >Subject: RE: SharedPerformanceCounter.CreateInstance exception [quoted text clipped - 29 lines] >> ================================================== >> Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications. >> ================================================== [quoted text clipped - 54 lines] >> >> ================================================== >> >> Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> >> ications. >> >> [quoted text clipped - 41 lines] >> >> > >> >> >Any ideas? Steven Cheng [MSFT] - 13 May 2008 11:12 GMT Hi Muntz,
Have you got any further progress on this? Or have you considered contact CSS for profesional incident based support if this is really an important and urgent issue?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
--------------------
>Content-Transfer-Encoding: 7bit >From: stcheng@online.microsoft.com (Steven Cheng [MSFT]) >Organization: Microsoft >Date: Fri, 09 May 2008 03:55:53 GMT >Subject: RE: SharedPerformanceCounter.CreateInstance exception
>Thanks for your reply Muntz, > [quoted text clipped - 47 lines] >>> >> >>> >> -
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|