System.Xml.Exception

Hi,

since the update to1.6.3 no deploy is running without an error. Here our deploy log:

2013-09-17 21:58:16 DEBUG Begin deployment of package: pms_neu.1.2013.917.1411
2013-09-17 21:58:16 DEBUG Package file path: C:\Octopus\Applications.Tentacle\Packages\pms_neu.1.2013.917.1411_D300C37862A11E44A46245BA5B052E79.nupkg
2013-09-17 21:58:16 DEBUG Package file hash: 725bc689bb5e7a5cd8410cbf1e6d8aa1a0c3515b
2013-09-17 21:58:16 DEBUG Tentacle Agent information:
2013-09-17 21:58:16 DEBUG - Machine name: xxx
2013-09-17 21:58:16 DEBUG - Is 64-bit: True
2013-09-17 21:58:16 DEBUG - Service user name: SYSTEM
2013-09-17 21:58:16 DEBUG - CLR version: 4.0.30319.19080
2013-09-17 21:58:16 DEBUG - Current directory: xxx
2013-09-17 21:58:16 DEBUG - OS version: Microsoft Windows NT 6.1.7601 Service Pack 1
2013-09-17 21:58:16 DEBUG - Tentacle version: 1.6.3.1723
2013-09-17 21:58:16 DEBUG Package will be extracted to: xxx
2013-09-17 21:58:31 INFO [XML Transformation] Looking for any configuration transformation files
2013-09-17 21:58:31 INFO [XML Configuration] Looking for appSettings and connectionStrings in any .config files
2013-09-17 21:58:31 DEBUG [XML Configuration] Scanning configuration file: xxx\1.2013.917.1411\packages.config
2013-09-17 21:58:31 DEBUG [XML Configuration] Scanning configuration file:xxx\1.2013.917.1411\web.config
2013-09-17 21:58:31 INFO [Copy] Extracting package contents to 'xxx\phq_main’
2013-09-17 22:01:06 INFO [IIS] Updating IIS website named 'pms_neu’
2013-09-17 22:01:06 WARN [IIS] Could not find an IIS website or virtual directory named ‘pms_neu’ on the local machine. If you expected Octopus to update this for you, you should create the site and/or virtual directory manually. Otherwise you can ignore this message.
2013-09-17 22:01:06 DEBUG Storing a record of the deployment.
2013-09-17 22:01:06 DEBUG Storing a record of the deployment.
2013-09-17 22:01:06 ERROR System.Xml.XmlException: ‘.’, hexadecimal value 0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
at Octopus.Tentacle.Deployment.Journal.DeploymentJournalReaderWriter.d__0.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournalReaderWriter.cs:line 33
at System.Linq.Enumerable.d__881.MoveNext() at Octopus.Tentacle.Deployment.Journal.DeploymentJournalReaderWriter.Overwrite(IEnumerable1 elements) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournalReaderWriter.cs:line 56
at Octopus.Tentacle.Deployment.Journal.DeploymentJournal.AppendFailedDeployment(JournalEntry journalEntry, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournal.cs:line 46
at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 50
at Octopus.Tentacle.Services.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object ignored) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Services\Jobs\JobQueue.cs:line 82

Do you an advice?

Hi,

In C:\Octopus\Applications.Tentacle there should be a Deployments.xml file - could you open this and send it to me? It sounds like it might have become corrupt.

Paul

Hi Paul,
I’m a similar error. The deployments.xml file superficially looks OK.

Anything else to try?

Best regards
Steve

2014-02-05 11:43:33 ERROR System.Xml.XmlException: ‘.’, hexadecimal value 0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
at Octopus.Tentacle.Deployment.Journal.DeploymentJournalReaderWriter.d__0.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournalReaderWriter.cs:line 33
at System.Linq.Enumerable.d__881.MoveNext() at Octopus.Tentacle.Deployment.Journal.DeploymentJournalReaderWriter.Overwrite(IEnumerable1 elements) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournalReaderWriter.cs:line 56
at Octopus.Tentacle.Deployment.Journal.DeploymentJournal.AppendFailedDeployment(JournalEntry journalEntry, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournal.cs:line 46
at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 50
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Tentacle.Services.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object ignored) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Services\Jobs\JobQueue.cs:line 82

Hi Steve - definitely looks like there’s something going on with the file in this case. The rendering of the file in a text editor won’t necessarily show encoding problems - can you please:

  • Open the DeploymentJournal.xml file in Notepad
  • Choose Save As…
  • Verify that the encoding (bottom of the dialog) is specified as UTF-8
  • Save the file

Not certain this will set things right, but should provide a starting point.

Backing up the file, then deleting it, as a last resort, should get things up and running again if the suggestion above doesn’t help (though doing so may prevent some deployed packages being cleaned up by the retention policy, if one is in use).

Hope this helps, let us know how you go!

Nick

Hmm, odd. When I looked at the file before it seemed to have data in it. Today it’s empty.

I have deleted it and the deployments are flowing again.

Thanks for your help.

This happened during a shutdown on the server, so I wonder if the file isn’t being closed properly.

S.

this problem just occurred for me. I deleted the corrupted DeploymentJournal.xml, and the tentacle resumed proper operation.

can I recommend and update to the tentacle code to handle this more robustly? Instead of crashing, how about just deleting or renaming the offending file and continuing to operate?

Hi Mike,
Thanks for letting us know that you have encountered a similar sounding issue.
Since it sounds like a rare occurrence our preferred fix wouldn’t be to automatically delete the deploymentJournal and continue since this would affect things like retention policy and previous deployments would, unbeknownst to the user, be no longer removed. Ideally what we would like to do in these cases is get a copy of this corrupted file and work out why it became corrupt in the first place. Next time this happens to your could you please send us a copy of the deploymentjournal.xml file so that we might be able to diagnose what part of it is causing problems. In the past this has been reported to have occurred when some other software modified the file’s contents.
In the meantime, deleting the file as you described is a valid work around however keep in mind that, as described above, your may then have orphaned deployments that no longer get cleaned up by the Tentacle retention policy. Check out our documentation on how to discern what deployments are no longer recorded in the journal and can be safely deleted.
Thanks again
Robert

I woke up this morning to discover that one of my Tentacles walked off the job (service was stopped). When I restarted it, I started getting the above exception.

When I checked my deploymentjournal.txt file, I found 10,477 bytes of \x00, and nothing else. Seems like when the Tentacle quit, the deployment journal had been created, but no data ever got written/flushed.

Hi Sblom,
Thanks for getting in contact. Was there anything in the Tentacle or Windows logs which might indicate why or where it failed? Are there any other .backup files in the same directory as the deploymentjournal.txt file? These are used during the writing process so perhaps something has done awry at this point.
Once we have ascertained how this error is occurring we can then work on patching Calamari to prevent it from happening.
Thanks
Robert