Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-9715

Confluence crash can result in empty confluence.cfg.xml file.

      I've had this come up in at least three issues. Seems like the easiest fix is to make a backup of the existing file before any writes.

      Update

      I've closed this issue as it got to be a mess of multiple issues. The following two linked issues are where you should go from here:

      • CONF-8898 - we should be able to recover from an automatic backup of confluence-cfg.xml if the main file is corrupted
      • CONF-15549 - Windows servers will show warning messages about non-atomic updates of confluence-cfg.xml

            [CONFSERVER-9715] Confluence crash can result in empty confluence.cfg.xml file.

            Got the same problem in Confluence 7.18.1 running within Docker container :|

            Adrian Kraska added a comment - Got the same problem in Confluence 7.18.1 running within Docker container :|

            This is still present in Confluence 6.3.2. Happened to me on CentOS 7.4 yesterday.

            Javier Távara added a comment - This is still present in Confluence 6.3.2. Happened to me on CentOS 7.4 yesterday.

            CharlesA added a comment -

            I'm resolving this issue as fixed. The "write to another file first" trick seems to work well enough to prevent us from ending up with empty cfg.xml files: all the linked support cases since we've implemented the fix have referred only to the warning message.

            Will file a different issue for that message.

            CharlesA added a comment - I'm resolving this issue as fixed. The "write to another file first" trick seems to work well enough to prevent us from ending up with empty cfg.xml files: all the linked support cases since we've implemented the fix have referred only to the warning message. Will file a different issue for that message.

            Michael S added a comment -

            This is still occuring in 2.10.3

            Michael S added a comment - This is still occuring in 2.10.3

            The message

             
            [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\confluence\data-2.10.2\confluence.cfg.xml9070676172658464167tmp to 
            D:\confluence\data-2.10.2\confluence.cfg.xml. Falling back to non-atomic overwrite.
            

            should now only occur on Windows machines. Unfortunately it is not actually possible to perform an atomic move to an existing file on a Windows operating system (through the File api), and so it will have
            to fall back to a non atomic write.
            The warning should not be a source of any concern.

            Regards,
            Andrew Lynch

            Andrew Lynch (Inactive) added a comment - The message [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\confluence\data-2.10.2\confluence.cfg.xml9070676172658464167tmp to D:\confluence\data-2.10.2\confluence.cfg.xml. Falling back to non-atomic overwrite. should now only occur on Windows machines. Unfortunately it is not actually possible to perform an atomic move to an existing file on a Windows operating system (through the File api), and so it will have to fall back to a non atomic write. The warning should not be a source of any concern. Regards, Andrew Lynch

            Error still existant in Confluence 2.10.2:

            2009-02-18 20:59:53,527 INFO [Thread-1] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 2.10.2 (build #1518)
            2009-02-18 20:59:53,715 INFO [Thread-1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [bootstrapContext.xml]
            2009-02-18 20:59:54,277 INFO [Thread-1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [setupContext.xml]
            2009-02-18 20:59:56,558 WARN [Thread-1] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\confluence\data-2.10.2\confluence.cfg.xml9070676172658464167tmp to D:\confluence\data-2.10.2\confluence.cfg.xml. Falling back to non-atomic overwrite.
            2009-02-18 20:59:57,730 INFO [Thread-1] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve
            

            Open new issue?

            Michael Michael added a comment - Error still existant in Confluence 2.10.2: 2009-02-18 20:59:53,527 INFO [ Thread -1] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 2.10.2 (build #1518) 2009-02-18 20:59:53,715 INFO [ Thread -1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [bootstrapContext.xml] 2009-02-18 20:59:54,277 INFO [ Thread -1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [setupContext.xml] 2009-02-18 20:59:56,558 WARN [ Thread -1] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\confluence\data-2.10.2\confluence.cfg.xml9070676172658464167tmp to D:\confluence\data-2.10.2\confluence.cfg.xml. Falling back to non-atomic overwrite. 2009-02-18 20:59:57,730 INFO [ Thread -1] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve Open new issue?

            CharlesA added a comment -

            No review necessary, library patch already reviewed.

            CharlesA added a comment - No review necessary, library patch already reviewed.

            CharlesA added a comment -

            Quick brain dump. The error message is reasonably harmless. Basically it means that Confluence had to use a slightly unsafe way of writing its main config file. Unless Confluence actually crashes while doing the write, which is very unlikely, everything should be OK.

            This message only appears on upgrade because the only information in confluence.cfg.xml that gets updated outside Confluence setup any more is the stored build number, which only changes during upgrades.

            The fix to CONFIG-12 (currently in code review) will prevent this error message in most circumstances where it was currently occurring by changing the way we do atomic overwrites of the config file.

            CharlesA added a comment - Quick brain dump. The error message is reasonably harmless. Basically it means that Confluence had to use a slightly unsafe way of writing its main config file. Unless Confluence actually crashes while doing the write, which is very unlikely, everything should be OK. This message only appears on upgrade because the only information in confluence.cfg.xml that gets updated outside Confluence setup any more is the stored build number, which only changes during upgrades. The fix to CONFIG-12 (currently in code review) will prevent this error message in most circumstances where it was currently occurring by changing the way we do atomic overwrites of the config file.

            From a quick test rig, this happens on Windows when you try and rename across filesystems (C:\something.txt to D:\something.txt).
            So CONFIG-12 should fix this problem for Windows too.

            Paul Curren added a comment - From a quick test rig, this happens on Windows when you try and rename across filesystems (C:\something.txt to D:\something.txt). So CONFIG-12 should fix this problem for Windows too.

            CharlesA added a comment -

            CONFIG-12 should make this more reliable on Unix systems, we'll still need to test why/how this happens on Windows

            CharlesA added a comment - CONFIG-12 should make this more reliable on Unix systems, we'll still need to test why/how this happens on Windows

              cmiller CharlesA
              donna@atlassian.com DonnaA
              Affected customers:
              4 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: