I am running Umbraco 4.5.2 on Windows Server 2008 R2 and SQL Server 2008 R2 using .net 4 and IIS 7.
I have an issue where my site repeatedly reverts to the Umbraco 'No nodes' splash page.
I checked the Umbraco log table and the system event logs and didn't discover anything.
I have elmah installed and I seem to be getting a lot of the following two exceptions:
System.Data.SqlClient.SqlException: Cannot
open database "xxxxxx" requested by the login. The login failed.
Login failed for user 'xxxxxx'.
System.Data.SqlClient.SqlException: Timeout
expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
I've verified the SQL server conncetion details in my web.config and they are correct.
To me this all suggests that occasionally Umbraco can't connect to SQL server - probably an issue with the VPS host that I am using being not so good (again). The SQL server is installed in the same VM as IIS BTW.
Anyway - my question is. In what situation would Umbraco attempt to rebuild umbraco.config during the normal request cycle? These errors all occur when no-one is using the back office and performing any updates of content. Where and how could a database connection error cause umbraco.config to be unavailable?
I've looked in the logs and the above error messages don't coincide with application startups in the umbracoLog table. As I understand it Umbraco should be resilient in the sense that pages are rendered from umbraco.config which is created at app startup and modified when users perform certain operations in the back office.
Duh: This helps doesn't it :) I'll have a dig around in the code but if anyone has any ideas.....
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> umbraco.DataLayer.SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)
at umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteReader(String commandText, SqlParameter[] parameters)
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
--- End of inner exception stack trace ---
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
at umbraco.cms.businesslogic.web.Domain.<GetDomains>b__0()
at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemRemovedCallback refreshAction, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
at umbraco.cms.businesslogic.web.Domain.GetDomains()
at umbraco.cms.businesslogic.web.Domain.GetDomain(String DomainName)
at umbraco.cms.businesslogic.web.Domain.Exists(String DomainName)
at umbraco.requestHandler.CreateXPathQuery(String url, Boolean checkDomain)
at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url)
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I've had the same problem on a couple of occasions myself which have usually happened, as you say, when the system hasn't been touched in a while. My thought would be that some timeout is being reached when Umbraco tries to connect to the DB (which has since wound itself down due to lack of use) and so gives up, and just shows the splash screen (this is all just my guess).
I know it's not an actual solution, but one work-around for the time being, could be to use an uptime service like http://uptimerobot.com/ to constantly check your site, and thus, never let it close down.
I'd still be interested in the actual solution mind, but this solution is usually good enough for me, and also has the added advantage of letting me know when a site is down.
I have no solution to this, but experienced something similar. However this happened only once, in my case. So far my solution has been to set up a pingdom account to tell me if it happens again, and then I will investigate further. I was also under the impression that a missing sql connection _should_ not cause this, but I might be wrong.
I've had this with my host a couple of times and it turned out that the reason I was getting the no-nodes splash screen was to do with the fact that the cache was always been cleared on my server.
I only noticed this because I was having to republish the site again for it to work and not show the no nodes splash screen.
I think you can get it to validate the occurance of a line of text, so you could check for a specific line of text in the page, but again, it doesn't really solve it.
Yup, like Matt said, it can look for a certain bit of text on the page. So if it does not show my footer (meaning it shows an error of some sort), then I will get notified. But again, it is only a solution to reducing the time it takes to react to the problem.
We've been battling with this problem too and it's caused us much embarrassment with our clients. It always occurs when we reboot our hosting servers. The only way to get around it, we've found, is to switch off using the cache file (umbraco.config) on our production sites. This is not an ideal solution as you can imagine, but it's better than the embarrassing downtime we've suffered.
Yes, I tested the app pool theory and that doesn't appear to cause it, it has to be a full reboot.
How about setting IIS to manual start and SQL Server to auto. Then set up a scheduled task (Powershell?) that checks to see if IIS is running (and SQL is running already) and if not starts it? This could run every minute. obviously it has some overhead but should be minimal.
So I guess we should change the noNodes.aspx page to show a more friendly -and less embarrassing- message to the visitor. Something to "We will be right back soon!" I'm going to try to modify a projects's nonodes.aspx to send an email to the admin to alert him and to tell him to publish the site again.
That was that problem. I was reference 4.1 apparently. So, next problem, code compiles and executes without error, but my cache is not being rebuilt. I replaced my noNodes.aspx with a custom version and put the following in codebehind. I copied the DLL to bin. When the noNodes page is hit, I see my custom version, but the cache is not rebuilt.
using System; using System.Xml; using umbraco; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.web; using umbraco.IO;
namespace SBA.AZBar { public partial class noNodes : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Server.ScriptTimeout = 100000; var cacheFile = IOHelper.MapPath("/App_Data/umbraco.config");
var r = XmlReader.Create(cacheFile, new XmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore }); var d = new XmlDocument(); d.Load(r);
var n = d.SelectSingleNode("//root"); if (n.ChildNodes.Count != 0) return;
Just incase anyone else is thinking they have to put Darren's code in the codebehind & mess around with dlls you don't have to. Just replace the config/splashes/nonodes.aspx file with the Darren's code as follows:
Just been experiencing the same issue. Out of interest were the people affected 1 week ago using SoftSys? They had a hardware fault and swapped out a SQL Server machine which caused this problem to occur on several of my sites.
I just made a small change to Claire's code:
if (n.ChildNodes.Count == 0) { Document.RePublishAll(); library.RefreshContent(); } Response.Redirect("/");
In order to make sure the redirect occurs even if not republished.
I've asked them to add these announcements to twitter but that has not been done yet - they mainly use their twitter account for tweeting customer reviews (which seems a bit pointless)
Is there a way to force this error to confirm whether the noNodes.aspx fix from Darren (and amended by Claire) works as intended, at least in my environment?
You should be able to reproduce by stopping the website & DB server (or somehow preventing access to it), then starting the website and visiting it while the DB is still inaccessible. Then you should get the no nodes page, even after starting the DB server again.
I seem to be getting this issue, or one very similar at least
umbraco v
4.7.0 (Assembly version: 1.0.4090.38017)
To Reproduce
Loaded a RePublishig page to tax the Sql DB
Recycled the Umbrco App Pool
Then imeedietly did the "Republish entire site"
Then no nodes will display data, instead it will just be a 404
At / (Referred by: ): System.NullReferenceException: Object reference not set to an instance of an object.
at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url)
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreInit(EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Optimally you would do an upgrade to 4.7.2. If that's not a possibility for some reason, you *could* take the 4.6 build, track down the fix (referenced somewhere else in this thread) and implement.
Although I'm not an Umbraco developer, (I normally work with another CMS) I came across this thread because I had a client's site we inherited that was having this issue. The repair code above gave me an error and did not complete. It seemed to fail because the umbraco.config file was still open after checking for valid nodes.
This is my variation on the revised NoNodes.aspx page. This will rebuild the cache file if missing or has no nodes. It also will give a little feedback to let you know what's going on.
<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="noNodes.aspx.cs"Inherits="umbraco.presentation.config.splashes.noNodes"%><%@ImportNamespace="umbraco"%><%@ImportNamespace="System.Xml"%><%@ImportNamespace="umbraco.cms.businesslogic.web"%><%@ImportNamespace="umbraco.IO"%><scriptrunat="server">protectedvoid Page_Load(object sender, EventArgs e)
{
Server.ScriptTimeout = 100000;
var cacheFile = IOHelper.MapPath("/App_Data/umbraco.config");
try
{
var r = XmlReader.Create(cacheFile, newXmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore });
var d = newXmlDocument();
d.Load(r);
var n = d.SelectSingleNode("//root");
r.Close();
if (n.ChildNodes.Count == 0)
{
Response.Write("Republishing Site......");
Response.Flush();
}
else
{
Response.Write("Site Was Already Published......");
return;
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.Write("Cache missing, republishing.....");
Response.Flush();
}
Document.RePublishAll();
library.RefreshContent();
Response.Write("Completed");
Response.Flush();
Response.End();
}
</script>
Site repeatedly reverting to no nodes splash page
Hi All,
I am running Umbraco 4.5.2 on Windows Server 2008 R2 and SQL Server 2008 R2 using .net 4 and IIS 7.
I have an issue where my site repeatedly reverts to the Umbraco 'No nodes' splash page.
I checked the Umbraco log table and the system event logs and didn't discover anything.
I have elmah installed and I seem to be getting a lot of the following two exceptions:
System.Data.SqlClient.SqlException: Cannot open database "xxxxxx" requested by the login. The login failed. Login failed for user 'xxxxxx'.
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I've verified the SQL server conncetion details in my web.config and they are correct.
To me this all suggests that occasionally Umbraco can't connect to SQL server - probably an issue with the VPS host that I am using being not so good (again). The SQL server is installed in the same VM as IIS BTW.
Anyway - my question is. In what situation would Umbraco attempt to rebuild umbraco.config during the normal request cycle? These errors all occur when no-one is using the back office and performing any updates of content. Where and how could a database connection error cause umbraco.config to be unavailable?
I've looked in the logs and the above error messages don't coincide with application startups in the umbracoLog table. As I understand it Umbraco should be resilient in the sense that pages are rendered from umbraco.config which is created at app startup and modified when users perform certain operations in the back office.
Many Thanks for any suggestions.
Duh: This helps doesn't it :) I'll have a dig around in the code but if anyone has any ideas.....
Hi Darren,
I've had the same problem on a couple of occasions myself which have usually happened, as you say, when the system hasn't been touched in a while. My thought would be that some timeout is being reached when Umbraco tries to connect to the DB (which has since wound itself down due to lack of use) and so gives up, and just shows the splash screen (this is all just my guess).
I know it's not an actual solution, but one work-around for the time being, could be to use an uptime service like http://uptimerobot.com/ to constantly check your site, and thus, never let it close down.
I'd still be interested in the actual solution mind, but this solution is usually good enough for me, and also has the added advantage of letting me know when a site is down.
Matt
I have no solution to this, but experienced something similar. However this happened only once, in my case. So far my solution has been to set up a pingdom account to tell me if it happens again, and then I will investigate further. I was also under the impression that a missing sql connection _should_ not cause this, but I might be wrong.
Morten, Pingdom doesn't help because the site is still up - just displaying a no nodes page.
Hi Darren,
I've had this with my host a couple of times and it turned out that the reason I was getting the no-nodes splash screen was to do with the fact that the cache was always been cleared on my server.
I only noticed this because I was having to republish the site again for it to work and not show the no nodes splash screen.
Hope this helps
Tom
Darren,
I think you can get it to validate the occurance of a line of text, so you could check for a specific line of text in the page, but again, it doesn't really solve it.
Matt
I've downloaded the 4.5.2 release code and I'll dig around for a while.
Yup, like Matt said, it can look for a certain bit of text on the page. So if it does not show my footer (meaning it shows an error of some sort), then I will get notified. But again, it is only a solution to reducing the time it takes to react to the problem.
Be interresting to hear if you find anything.
@mat, @morten thanks for the tip about checking for a string in a page.
I'll endeavour to resolve the issue and post here when I find out what is wrong.
On my laptop I have SQL Server set to manual start. Whenever I reboot and go to an umbraco site I get the splash screen.
I can recreate this by
1. Shut down SQL Server
2. Shut down IIS
3. Start IIS
4. Start SQL Server
Go to the Umb site and you *should* have the splash screen.
So, my theory is that if the app pool recycles or the iis site goes down whilst it has lost it's connection to SQL you get the splash screen.
Jay
Good stuff.
That is the theory that I was looking to prove too.
I'm going through my event logs and I can see the VPS being rebooted. I'll go to my ISP and find out why.
I guess that IIS is coming up before SQL server and hence the communication error.
Still not sure why Umbraco doesn't fall back to the previous umbraco.config though.
Ok - so my ISP has automatic updates enabled which allow Windows update to reboot the server.
We've been battling with this problem too and it's caused us much embarrassment with our clients. It always occurs when we reboot our hosting servers. The only way to get around it, we've found, is to switch off using the cache file (umbraco.config) on our production sites. This is not an ideal solution as you can imagine, but it's better than the embarrassing downtime we've suffered.
Yes, I tested the app pool theory and that doesn't appear to cause it, it has to be a full reboot.
How about setting IIS to manual start and SQL Server to auto. Then set up a scheduled task (Powershell?) that checks to see if IIS is running (and SQL is running already) and if not starts it? This could run every minute. obviously it has some overhead but should be minimal.
So I guess we should change the noNodes.aspx page to show a more friendly -and less embarrassing- message to the visitor. Something to "We will be right back soon!" I'm going to try to modify a projects's nonodes.aspx to send an email to the admin to alert him and to tell him to publish the site again.
@bill good idea
All - to workaround this I've added the following code to a custom noNodes.aspx page.
All - to workaround this I've added the following code to a custom noNodes.aspx page (it does a republish all).
You can do the following to check if you have an empty cache before executing the code above.
I've been hit by the "no nodes" too today...
Darren, I've also posted this question on your blog: how do I go about putting this custom no nodes page in place?
Thanks in advance,
/HFS
@Happyfanaticsalsero what don't you understand? You just replace /config/splashes/noNodes.aspx with your own version that executes the code above.
OK, thanks. I just wasn't entirely sure. I'll post back with the result.
/HFS
Daren, your code does not work since IOHelper cannot be found in the umbraco namespace.
Hi Connie,
What version of Umbraco are you using? I think IOHelper was only introduced in v4.5x
Many thanks
Matt
That was that problem. I was reference 4.1 apparently. So, next problem, code compiles and executes without error, but my cache is not being rebuilt. I replaced my noNodes.aspx with a custom version and put the following in codebehind. I copied the DLL to bin. When the noNodes page is hit, I see my custom version, but the cache is not rebuilt.
Apparently one can make windows services depend on each other.
http://support.microsoft.com/kb/193888
I don't think that will work when the SQL Service is on another server.
No, it wouldn't.
Just incase anyone else is thinking they have to put Darren's code in the codebehind & mess around with dlls you don't have to. Just replace the config/splashes/nonodes.aspx file with the Darren's code as follows:
Thankyou Darren this works great, but is it on codeplex? It's a bit of a showstopper don't you think!
Hi,
Just been experiencing the same issue. Out of interest were the people affected 1 week ago using SoftSys? They had a hardware fault and swapped out a SQL Server machine which caused this problem to occur on several of my sites.
I just made a small change to Claire's code:
In order to make sure the redirect occurs even if not republished.
Hi Paul,
Yep, i'm with softsys and all my sites experienced the same problem.
I cant remember getting an email though from Softsys stating this :(
Tom
no email would have been sent. I found out by going to http://members.softsyshosting.com/announcements.php
I've asked them to add these announcements to twitter but that has not been done yet - they mainly use their twitter account for tweeting customer reviews (which seems a bit pointless)
You can subscribe to the RSS feed of the announcements - that how I keep track of them.
Is there a way to force this error to confirm whether the noNodes.aspx fix from Darren (and amended by Claire) works as intended, at least in my environment?
Thanks!
You should be able to reproduce by stopping the website & DB server (or somehow preventing access to it), then starting the website and visiting it while the DB is still inaccessible. Then you should get the no nodes page, even after starting the DB server again.
I've made this a Codeplex issue at http://umbraco.codeplex.com/workitem/30236.
I think this was already fixed for 4.7, per http://umbraco.codeplex.com/workitem/29833
Tom is correct as it appears this issue has been addressed in 4.7.
Thanks Tom!
I seem to be getting this issue, or one very similar at least
umbraco v 4.7.0 (Assembly version: 1.0.4090.38017)
To Reproduce
Loaded a RePublishig page to tax the Sql DB
Recycled the Umbrco App Pool
Then imeedietly did the "Republish entire site"
Then no nodes will display data, instead it will just be a 404
At / (Referred by: ): System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url) at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.OnPreInit(EventArgs e) at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
We are running 4.6.1 and are getting this problem. The DB connection fails then we end up with a 1KB umbraco.config file.
We don't get the no nodes page but the same as the above post.
Problem is made worse as the site is very big and it takes 15 minutes or so to rebuiild the XML which is proving very embarrassing.
Any ideas? Solutions?
Is it an option to upgrade to Umbraco 4.7? The 4.6 version did have a lot of problems which are fixed in 4.7.
Jeroen
Optimally you would do an upgrade to 4.7.2. If that's not a possibility for some reason, you *could* take the 4.6 build, track down the fix (referenced somewhere else in this thread) and implement.
Ted
Although I'm not an Umbraco developer, (I normally work with another CMS) I came across this thread because I had a client's site we inherited that was having this issue. The repair code above gave me an error and did not complete. It seemed to fail because the umbraco.config file was still open after checking for valid nodes.
This is my variation on the revised NoNodes.aspx page. This will rebuild the cache file if missing or has no nodes. It also will give a little feedback to let you know what's going on.
is working on a reply...