OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Warnings from NHibernate when on Azure #4133

Open orchardbot opened 10 years ago

orchardbot commented 10 years ago

gregslater created: https://orchard.codeplex.com/workitem/20304

I'm seeing repeated warnings from NHibernate on an Azure cloud service (I assume they're warnings, the level isn't included in the log message):

NHibernate.Cache.ReadWriteCache - An item was expired by the cache while it was locked (increase your cache timeout): Orchard.Core.Settings.Descriptor.Records.ShellDescriptorRecord#1 ; TraceSource 'w3wp.exe' event

NHibernate.Cache.NoCacheProvider - Second-level cache is enabled in a class, but no cache provider was selected. Fake cache used. ; TraceSource 'w3wp.exe' event

These warnings are logged constantly - about 100 times per second! The first one is repeated for various records.

I'm running 2 ExtraSmall instances. I did not have this problem until upgrading from 1.5.1 to 1.7.2

SysCache is disabled as recommended here. Is it safe to ignore these warnings? If so, can they be "silenced" without changing the log level to ERROR?

UPDATE

It seems that the second message about "fake cache" is logged as a warning by the NHibernate NoCacheProvider every time its BuildCache method is called to configure the cache. I assume this is an issue with NHibernate, because I can't think why it would log a warning every time the cache provider is created, surely just once would do! However, should we implement an NHibernate cache provider in Orchard? Even though using the SysCache module when more than one Azure instance is not recommended?

A workaround (though not ideal) is to change the log level for the Azure project to ERROR instead of WARN.

orchardbot commented 10 years ago

@sebastienros commented:

We can't prevent the warning from being written. What should be changed is that the default log level for Azure should be ERROR and not WARN.

to be fixed in src\Orchard.Azure\Orchard.Azure.Web\Config\log4net.Release.config