locked
Custom counters file view is out of memory RRS feed

  • Question

  • We are getting this about once a week. 

    An exception of type 'System.TypeInitializationException' occurred and was caught.
    
    ----------------------------------------------------------------------------------
    
    04/23/2010 16:49:48
    
    Type : System.TypeInitializationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    
    Message : The type initializer for 'Microsoft.CommerceServer.Catalog.Internal.CatalogCache' threw an exception.
    
    Source : Microsoft.CatalogServer
    
    Help link : 
    
    TypeName : Microsoft.CommerceServer.Catalog.Internal.CatalogCache
    
    Data : System.Collections.ListDictionaryInternal
    
    TargetSite : System.Data.DataSet GetDataset(Microsoft.CommerceServer.Catalog.Internal.ExecutionContext, Microsoft.CommerceServer.Catalog.CacheItemType, System.String, Microsoft.CommerceServer.Catalog.Internal.CatalogDataSetType, Boolean, System.Object[], Boolean ByRef)
    
    Stack Trace : at Microsoft.CommerceServer.Catalog.Internal.CatalogCache.GetDataset(ExecutionContext executionContext, CacheItemType cacheItemType, String storedProcedureName, CatalogDataSetType catalogDataSetType, Boolean getFromCache, Object[] parameters, Boolean& obtainedFromCache)
    
    at Microsoft.CommerceServer.Catalog.Internal.CatalogAttributes.GetProperties(ExecutionContext executionContext, String searchClause, Boolean getFromCache)
    
    at Microsoft.CommerceServer.Catalog.Internal.CatalogServerContextBase.GetProperties(String searchClause)
    
    at Microsoft.CommerceServer.Catalog.CatalogProperty.GetProperties(CatalogContext catalogContext, String searchClause)
    
    at Microsoft.CommerceServer.Catalog.CatalogContext.GetProperties()
    
    at Microsoft.Commerce.Providers.Metadata.CatalogMetadataProvider.LoadCatalogPropertiesMetadata()
    
    at Microsoft.Commerce.Providers.Metadata.CatalogMetadataProvider.GetMetadata()
    
    at Microsoft.Commerce.Providers.Metadata.CatalogMetadataLoader.GetSubsystemMetadata(String siteName)
    
    at Microsoft.Commerce.Providers.Metadata.SubsystemMetadataLoader.ExecuteQuery(CommerceQueryOperation queryOperation, OperationCacheDictionary operationCache, CommerceQueryOperationResponse response)
    
    at Microsoft.Commerce.Providers.Components.OperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response)
    
    at Microsoft.Commerce.Broker.OperationSequence.ExecuteComponentTree(List`1 executionTreeList, CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response)
    
    at Microsoft.Commerce.Broker.OperationSequence.Execute(CommerceOperation operation)
    
    at Microsoft.Commerce.Broker.MessageHandler.ProcessMessage(String messageHandlerName, CommerceOperation operation)
    
    at Microsoft.Commerce.Broker.OperationService.InternalProcessRequest(CommerceRequest request)
    
    at Microsoft.Commerce.Providers.Utility.CommerceEntityMetadata.ExecuteMetadataQuery(MetadataCacheKey cacheKey, String modelName)
    
    at Microsoft.Commerce.Providers.Utility.CommerceEntityMetadata.<>c__DisplayClass1.<Get>b__0(MetadataCacheKey cacheKey)
    
    at Microsoft.Commerce.Application.Common.CachedFactory`2.GetOrCreate(TKey key, CreateInstance`2 factory)
    
    at Microsoft.Commerce.Providers.Utility.CommerceEntityMetadata.Get(String modelName, Nullable`1 commerceArea)
    
    at Microsoft.Commerce.Providers.Utility.ProfileMetadata.CreateProfileMetadata(MetadataCacheKey key, String modelName)
    
    at Microsoft.Commerce.Providers.Utility.ProfileMetadata.<>c__DisplayClass5.<Get>b__4(MetadataCacheKey key)
    
    at Microsoft.Commerce.Application.Common.CachedFactory`2.GetOrCreate(TKey key, CreateInstance`2 factory)
    
    at Microsoft.Commerce.Providers.Utility.ProfileMetadata.Get(String modelName)
    
    at Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.AreSearchParametersValid(CommercePropertyCollection properties)
    
    at Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.ValidateSearchCriteria(CommerceModelSearch searchCriteria)
    
    at Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.GetMatches(CommerceModelSearch searchCriteria, Nullable`1& totalItemCount, Boolean throwIfNotFound)
    
    at Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.GetMatches(CommerceModelSearch searchCriteria, Nullable`1& totalItemCount)
    
    at Microsoft.Commerce.Providers.Components.ProfileLoaderBase.ExecuteQuery(CommerceQueryOperation queryOperation, OperationCacheDictionary operationCache, CommerceQueryOperationResponse response)
    
    at Microsoft.Commerce.Providers.Components.OperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response)
    
    at Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response)
    
    at Microsoft.Commerce.Broker.OperationSequence.ExecuteComponentTree(List`1 executionTreeList, CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response)
    
    at Microsoft.Commerce.Broker.OperationSequence.Execute(CommerceOperation operation)
    
    at Microsoft.Commerce.Broker.MessageHandler.ProcessMessage(String messageHandlerName, CommerceOperation operation)
    
    at Microsoft.Commerce.Broker.OperationService.InternalProcessRequest(CommerceRequest request)
    
    at Microsoft.Commerce.Broker.OperationService.ProcessRequest(CommerceRequest request)
    
    Additional Info:
    
    MachineName : DEV1
    
    TimeStamp : 4/23/2010 8:49:48 PM
    
    FullName : Microsoft.Commerce.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    
    AppDomainName : UTA_90fcc777-7e64-4639-989d-85bdc522971f
    
    ThreadIdentity : 
    
    WindowsIdentity : domain\user
    
    Inner Exception
    
    ---------------
    
    Type : System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    
    Message : Custom counters file view is out of memory.
    
    Source : System
    
    Help link : 
    
    Data : System.Collections.ListDictionaryInternal
    
    TargetSite : Int32 CalculateMemory(Int32, Int32, Int32 ByRef)
    
    Stack Trace : at System.Diagnostics.SharedPerformanceCounter.CalculateMemory(Int32 oldOffset, 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)
    
    at System.Diagnostics.PerformanceCounter.Initialize()
    
    at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
    
    at Microsoft.CommerceServer.Internal.CommercePerfCounters.InternalGetCounter(String categoryId, String counterId, String instanceName)
    
    at Microsoft.CommerceServer.Internal.CommercePerfCounters.GetCounterWithCache(String categoryId, String counterId, String instanceName)
    
    at Microsoft.CommerceServer.Catalog.Internal.CachePerformanceCounters.Initialize(String instanceName)
    
    at Microsoft.CommerceServer.Catalog.Internal.CachePerformanceCounters..ctor(String instanceName, CachePerformanceCounters totalInstancePerfCounters)
    
    at Microsoft.CommerceServer.Catalog.Internal.CatalogCache..cctor()
    
    

     

    I have added this to my web.config (and app.config for my unit tests) as some articles suggest:

      <system.diagnostics>
      <performanceCounters filemappingsize="2147483647" />
      </system.diagnostics>

    I have also added this to my registry as other articles say (to disable counters):

    Windows Registry Editor Version 5.00 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: Catalog\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: Catalog Pipeline\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: Marketing\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: Orders\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: Pipelines\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Commerce: PromoCode Pipeline\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\csauthperf\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cscustomperf\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\csdwperf\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\csmarketingperf\Performance] 
    "Disable Performance Counters"=dword:00000001 
     
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\csupmperf\Performance] 
    "Disable Performance Counters"=dword:00000001
    The only thing resolving this issue is a reboot.  I would hate to have to reboot a production server when it comes time to go live.
    Friday, April 23, 2010 9:10 PM

All replies

  • Hi,

    you are not alone. We are having the same issue in our test environment (but not in production at least not so far). Our environments are 'almost' equal, test has just less processors and memory.

    We haven't found anything that would fix this behavior, other than the reboot when this occurs :-/

    Monday, April 26, 2010 9:31 AM
  • Hi

    This problem is often indicative of a commerce context initialization problem, or an environment where you are hosting many CommerceServer Sites on a single machine.  This can happen because each CommerceServer Site has many perf counters for each of the various resources (catalog, orders etc) and these counters multiplied by multiple sites can exceed the default size of shared memory for these counters.  Good news is that this default size can be increased. See MSDN.  But it’s probably not a bad idea to put some tracing around your context initialization code to insure that there aren’t multiple or un-necessary context creation calls.


    Please remember to click “mark as answered” when you get a reply that answers your question.
    Monday, April 26, 2010 1:52 PM
  • I only have 1 Commerce Site and I have the default size set to the max int value.
    Monday, April 26, 2010 9:17 PM
  • Well I think there are a couple of important points that you may have been missed in the link I specified in my previous post:

    1. ...the correct location to specify the fileMappingSize value is the Machine.config file.

    2. the maximum size is 33,554,432 bytes

    Lastly, do you know what else is going on with the server right before the crash?  Metadata is cached so something is forcing the metadata to be flushed so that it needs to be reloaded?  Perhaps some configuration changes being made or application pool recycling?


    Please remember to click “mark as answered” when you get a reply that answers your question.
    Monday, April 26, 2010 9:44 PM
  • Its happening on our dev servers as well.  I'm sure it has to do with unit testing outside the http context

    Tuesday, April 27, 2010 12:23 AM
  • Jay,

    Been a long time. I have had some problems with this in the past. It was related to a commerce applicaiton that we had running as a service to update the catalog based on product performance. Also running outside the commerce context. Once we stopped this applicaiton and incorporated it into our web applicaiton, the issue stopped happening. Also I've been doing some unit testing from another web based applicaiton with a lot better luck.

    ~Brad


    Brad Foley | www.blfoley.com
    Tuesday, April 27, 2010 2:31 AM
  • I have the same problem in the same scenario. I'm running a unit test that tries to fetch data from the product catalog (outside the http context).
    Tuesday, February 28, 2012 1:39 PM