I have a really, really weird issue with my umbraco installation.
If I recycle the app pool and open the site, then go into the backend and Republish Entire Site, the umbraco.config file updates fine no problems. Look in umbracoLog in the db and that looks fine too - no errors.
However, if I "Republish Entire Site" a few minutes later, umbraco.config no longer updates and I get errors in the log table.
Here's an example of what I'm getting:
Error Republishing: System.Xml.XmlException: The 'boxForumPosts' start tag on line 1 position 1110 does not match the end tag of 'risons'. Line 1, position 1126. at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag) at System.Xml.XmlTextReaderImpl.ParseEndElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at umbraco.content.LoadContentFromDatabase()
....or...
Error Republishing: System.Xml.XmlException: ',' is an unexpected token. The expected token is '='. Line 1, position 174. at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at umbraco.content.LoadContentFromDatabase()
The weird thing about this is the fact that umbraco.config will generate fine the first time around. However doing it again results in these errors, without having done anything to the node tree or even looking at the site.
I've tried to track down the errors, but they're inconsistent - the above are just 2 examples out of many. I'd almost go as far as saying it's as if the xml content is being truncated perhaps, and that's why it keeps on complaining.
If I delete umbraco.config after this happens it won't regenerate until the site has been hit, after which it does regenerate when republishing entire site.
Any ideas? This only cropped up after writing a tool to programatically insert new nodes and the cache failed to keep up (but bear in mind I've checked this issue out on a database copy before my tool has done anything, just to make sure I'm not cracking up!).
Are you using any custom data-types? From the error message it looks like the property/value for the "boxForumPosts" element isn't being closed properly (this could be a red herring though). Still whatever is happening, the generated umbraco.config is not valid XML.
Anything else you can tell us about the tool to create nodes programatically... could be related?
boxForumPosts is just a boolean against the document type to indicate if a macro should generate the content, so I don't think its that.
The tool itself takes an XML file and looks for matching nodes with the same name, and either updates, adds a new node or deletes those marked for deletion. Unfortunately this issue occurs against a fresh database copy before using this tool - so it's something that is happening before my meddling!
In terms of the error messages, they're also a bit of a red herring as they're always different. One will say '=' is not valid in a name, other's chop off halfway through like the one I posted which says 'risons', which is actually the other half of the word 'Morrisons'!
What is really weird is if I delete the umbraco.config file altogether, publish, visit the site so it regenerates - it does it fine and the log says 'Republishing started.." then "Republish complete" after a couple of seconds, so I don't think the XML is invalid. My suspicion is the regeneration is somehow either truncating the XML retrieved or it's not getting it in full from the db - but where to start looking is anyones guess.
The reason this was highlighted was when I ran my tool it uses linq to look for nodes that need deletion where a specific flag is set. However some of these nodes were deleted during a previous run, yet the linq still retrieves these nodes in the query so when it tries to delete them it complains saying the document doesn't exist. Looking in umbraco.config I can see the node in there, but in the db it's definitely gone - so I'm guessing linq2umbraco uses the cache to retrieve results.
Any help really appreciated - spent hours looking into the problem last night :(
Hmmm... this is a tricky one! Ok, here is how Umbraco publishes/republishes the XML cache (umbraco.config):
* The "Republish Entire Site" (from the Content menu item) will grab all the (existing) published XML from the "cmsContentXml" table in the database. It does not do a republish of each individual node ... only gets the last published version of the nodes. It usually happens very fast as it's reading the database and dumping it to an XML file.
* When you right-click on a node and "Publish" (and then select "Publish children" from the modal), then that will do a proper publish of that node (and child nodes). This regenerates the XML for those nodes. So if an error occurs here, then the XML is not going to be inserted/updated in the "cmsContentXml" table.
Check the error logs in the "umbracoLog" table ... see if any errors are silently happening during the publish event?
Well this is a bit weird. I can't replicate the problem at the moment so not sure what on earth is going on. However I'm starting to wonder if it's how I removed the documents programatically and why the config file got out of sync with the db.
I noticed I never get the same issue if I manually delete the document via the content tree. So with that in mind I looked at the Document class and noticed that the Delete option just moves it to the trash after unpublishing the node (which I guess is why the config file removes the node as well).
Here's the code I used to delete if it found one to remove :
try { Document nodeToDelete = new Document(nodeId);
if (nodeToDelete != null) { nodeToDelete.delete(true); //umbraco.library.UpdateDocumentCache(nodeId); totalNodesRemoved++; deleteResults.Add("Successfully removed node ID " + nodeId); } else deleteResults.Add(String.Format("Failed to remove node ID {0} - could not find document.", nodeId)); } catch (Exception ex) { deleteResults.Add(String.Format("Failed to remove node ID {0} - an exception occurred. {1}", nodeId, ex.ToString())); }
Here I'm using the deletePermanently method - so I guess that's why the config file is not updating but the db is.
I'll retry my tool using delete without the argument for permanent deletion and see if I can replicate the same issue rebuilding the XML tree. I'll also run a trace on the db to see if anything odd crops up there.
Major help needed with cache
Hi all,
I have a really, really weird issue with my umbraco installation.
If I recycle the app pool and open the site, then go into the backend and Republish Entire Site, the umbraco.config file updates fine no problems. Look in umbracoLog in the db and that looks fine too - no errors.
However, if I "Republish Entire Site" a few minutes later, umbraco.config no longer updates and I get errors in the log table.
Here's an example of what I'm getting:
....or...
The weird thing about this is the fact that umbraco.config will generate fine the first time around. However doing it again results in these errors, without having done anything to the node tree or even looking at the site.
I've tried to track down the errors, but they're inconsistent - the above are just 2 examples out of many. I'd almost go as far as saying it's as if the xml content is being truncated perhaps, and that's why it keeps on complaining.
If I delete umbraco.config after this happens it won't regenerate until the site has been hit, after which it does regenerate when republishing entire site.
Any ideas? This only cropped up after writing a tool to programatically insert new nodes and the cache failed to keep up (but bear in mind I've checked this issue out on a database copy before my tool has done anything, just to make sure I'm not cracking up!).
Any help would be gratefully received.
Tony
Hi Tony,
Are you using any custom data-types? From the error message it looks like the property/value for the "boxForumPosts" element isn't being closed properly (this could be a red herring though). Still whatever is happening, the generated umbraco.config is not valid XML.
Anything else you can tell us about the tool to create nodes programatically... could be related?
Thanks, Lee.
Hi Lee,
boxForumPosts is just a boolean against the document type to indicate if a macro should generate the content, so I don't think its that.
The tool itself takes an XML file and looks for matching nodes with the same name, and either updates, adds a new node or deletes those marked for deletion. Unfortunately this issue occurs against a fresh database copy before using this tool - so it's something that is happening before my meddling!
In terms of the error messages, they're also a bit of a red herring as they're always different. One will say '=' is not valid in a name, other's chop off halfway through like the one I posted which says 'risons', which is actually the other half of the word 'Morrisons'!
What is really weird is if I delete the umbraco.config file altogether, publish, visit the site so it regenerates - it does it fine and the log says 'Republishing started.." then "Republish complete" after a couple of seconds, so I don't think the XML is invalid. My suspicion is the regeneration is somehow either truncating the XML retrieved or it's not getting it in full from the db - but where to start looking is anyones guess.
The reason this was highlighted was when I ran my tool it uses linq to look for nodes that need deletion where a specific flag is set. However some of these nodes were deleted during a previous run, yet the linq still retrieves these nodes in the query so when it tries to delete them it complains saying the document doesn't exist. Looking in umbraco.config I can see the node in there, but in the db it's definitely gone - so I'm guessing linq2umbraco uses the cache to retrieve results.
Any help really appreciated - spent hours looking into the problem last night :(
Cheers!
Tony
Hi Tony,
Hmmm... this is a tricky one! Ok, here is how Umbraco publishes/republishes the XML cache (umbraco.config):
* The "Republish Entire Site" (from the Content menu item) will grab all the (existing) published XML from the "cmsContentXml" table in the database. It does not do a republish of each individual node ... only gets the last published version of the nodes. It usually happens very fast as it's reading the database and dumping it to an XML file.
* When you right-click on a node and "Publish" (and then select "Publish children" from the modal), then that will do a proper publish of that node (and child nodes). This regenerates the XML for those nodes. So if an error occurs here, then the XML is not going to be inserted/updated in the "cmsContentXml" table.
Check the error logs in the "umbracoLog" table ... see if any errors are silently happening during the publish event?
Good luck!
Cheers, Lee.
Thanks Lee - I'll see what comes up and update here. Nightmare! :)
Well this is a bit weird. I can't replicate the problem at the moment so not sure what on earth is going on. However I'm starting to wonder if it's how I removed the documents programatically and why the config file got out of sync with the db.
I noticed I never get the same issue if I manually delete the document via the content tree. So with that in mind I looked at the Document class and noticed that the Delete option just moves it to the trash after unpublishing the node (which I guess is why the config file removes the node as well).
Here's the code I used to delete if it found one to remove :
try {
Document nodeToDelete = new Document(nodeId);
if (nodeToDelete != null) {
nodeToDelete.delete(true);
//umbraco.library.UpdateDocumentCache(nodeId);
totalNodesRemoved++;
deleteResults.Add("Successfully removed node ID " + nodeId);
} else
deleteResults.Add(String.Format("Failed to remove node ID {0} - could not find document.", nodeId));
}
catch (Exception ex) {
deleteResults.Add(String.Format("Failed to remove node ID {0} - an exception occurred. {1}", nodeId, ex.ToString()));
}
Here I'm using the deletePermanently method - so I guess that's why the config file is not updating but the db is.
I'll retry my tool using delete without the argument for permanent deletion and see if I can replicate the same issue rebuilding the XML tree. I'll also run a trace on the db to see if anything odd crops up there.
Feel like I'm getting somewhere now!
Cheers,
Tony
is working on a reply...