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

            CharlesA added a comment -

            We create the temp file in java.io.tmp, so if it's on a different filesystem to the confluence.home, we can't do an atomic rename. This can cause this error on Unix systems.

            No idea why this doesn't work on Windows, but we should fix it so that the temp file is created in the same directory as the config file anyway.

            CharlesA added a comment - We create the temp file in java.io.tmp, so if it's on a different filesystem to the confluence.home, we can't do an atomic rename. This can cause this error on Unix systems. No idea why this doesn't work on Windows, but we should fix it so that the temp file is created in the same directory as the config file anyway.

            Same here after upgrading from 2.9 to 2.10 . Anybody an idea? Anyway, did not experience any issues so far... Regards michi

            Michael Michael added a comment - Same here after upgrading from 2.9 to 2.10 . Anybody an idea? Anyway, did not experience any issues so far... Regards michi

            forgot to add: Confluence didn't crash

            Thoralf Will added a comment - forgot to add: Confluence didn't crash

            I got the message right now after upgrading from 2.9 to 2.10:

            2008-12-04 10:58:57,827 WARN [main] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move /opt/confluence-2.10-std/temp/confluence.cfg.xml49382tmp to /var/data/confluence/confluence.cfg.xml. Falling back to non-atomic overwrite.

            I never had that error message before if I remember right.

            Thoralf Will added a comment - I got the message right now after upgrading from 2.9 to 2.10: 2008-12-04 10:58:57,827 WARN [main] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move /opt/confluence-2.10-std/temp/confluence.cfg.xml49382tmp to /var/data/confluence/confluence.cfg.xml. Falling back to non-atomic overwrite. I never had that error message before if I remember right.

            Don Willis added a comment -

            So, now that CONFIG-1 is fixed, should this issue be closed?
            Or is it still open because CONFIG-1 doesn't always work for Windows? (Does it ever?) I notice that at least one of the listed support cases was a windows one.

            And when I say: "doesn't work for windows" I'm assuming that based on getting a lot of warnings when running under windows:

            2008-11-05 18:50:39,953 WARN [main] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\Program Files\apache-tomcat-5.5.25\temp\confluence.cfg.xml58569tmp to D:\work\confluencehomes\hsqltrunk3\confluence.cfg.xml. Falling back to non-atomic overwrite.
            

            Don Willis added a comment - So, now that CONFIG-1 is fixed, should this issue be closed? Or is it still open because CONFIG-1 doesn't always work for Windows? (Does it ever?) I notice that at least one of the listed support cases was a windows one. And when I say: "doesn't work for windows" I'm assuming that based on getting a lot of warnings when running under windows: 2008-11-05 18:50:39,953 WARN [main] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move D:\Program Files\apache-tomcat-5.5.25\temp\confluence.cfg.xml58569tmp to D:\work\confluencehomes\hsqltrunk3\confluence.cfg.xml. Falling back to non-atomic overwrite.

            The best fix is to do atomic writes: when saving any config file, write to a temp file then overwrite the existing file in one move operation.

            Charles Miller (Inactive) added a comment - The best fix is to do atomic writes: when saving any config file, write to a temp file then overwrite the existing file in one move operation.

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

                Created:
                Updated:
                Resolved: