XML export of a Confluence Space fails with "Error creating temp file in folder"

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When performing an XML Export of a Confluence Space, the export may fail with the following error in the UI:

There was an error in the export. Please check your log files.
:Error creating temp file in folder: 
<confluence-home>/temp/xmlexport-<date>/attachments/<pageid>/<attachmentid>


See an example of the error below:

Environment

Confluence Server or Data Center running on Linux.

Confluence Home folder mounted on an ext3 or ext4 file system.

Diagnosis

Any export trial of the target Space fails with the same error message in the UI.

The following entries can be found in the atlassian-confluence.log.

Application log entries...
2020-06-17 21:02:37,069 ERROR [Long running task: Export Space] [confluence.importexport.actions.ExportSpaceLongRunningTask] doInTransactionWithoutResult Error during export
 -- url: /spaces/doexportspace.action | referer: http://10.125.91.230:8090/spaces/exportspacexml.action?key=SO | traceId: bfffe08bb52b53d2 | userName: admin | action: doexportspace
java.lang.RuntimeException: Error creating temp file in folder: /home/ubuntu/deployments/conf741/confluence-home/temp/xmlexport-20200617-201632-1/attachments/1342429/1342433
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataUtil.createTempFile(FileSystemAttachmentDataUtil.java:66)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataUtil.writeStreamToFile(FileSystemAttachmentDataUtil.java:37)
    at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.writeStreamToFile(FileSystemAttachmentDataDao.java:253)
    at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:240)
    at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:205)
    at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.saveAttachmentData(AbstractHibernateAttachmentDao.java:869)
    at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:840)
    at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupAttachments(FileXmlExporter.java:160)
    at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupEverything(FileXmlExporter.java:99)
    at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.doExport(AbstractXmlExporter.java:94)
    at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExportInternal(FileXmlExporter.java:60)
    at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExport(FileXmlExporter.java:54)
    at com.atlassian.confluence.importexport.impl.XmlExporter.doExport(XmlExporter.java:52)
    at com.atlassian.confluence.importexport.DefaultImportExportManager.doExport(DefaultImportExportManager.java:212)
    at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
    at com.sun.proxy.$Proxy291.exportAs(Unknown Source)
    at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:95)
    at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:36)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
    at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:68)
    at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)
    at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:39)
    at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: No such file or directory
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.createTempFile(File.java:2024)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataUtil.createTempFile(FileSystemAttachmentDataUtil.java:64)
    ... 43 more
2020-06-17 21:02:37,070 WARN [Long running task: Export Space] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
  ->[null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #1534451944)
        Showing 10 last transactions at this level out of 223 in total:
        [com.atlassian.confluence.upgrade.upgradetask.AttachmentRemoveFileStoreIDsUpgradeTask.getShortDescription]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #2128848446)
        [com.atlassian.confluence.upgrade.upgradetask.ContentIndexUpgradeTask.runOnSpaceImport]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT (Session #1535240739)
        [com.atlassian.confluence.upgrade.upgradetask.ContentIndexUpgradeTask.getBuildNumber]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #1147113303)
        [com.atlassian.confluence.upgrade.upgradetask.ContentIndexUpgradeTask.getShortDescription]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #1174478194)
        [com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentContentStatusUpgradeTask.runOnSpaceImport]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT (Session #3935704)
        [com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentContentStatusUpgradeTask.getBuildNumber]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #1260967714)
        [com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentContentStatusUpgradeTask.getShortDescription]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #1183342420)
        [com.atlassian.confluence.upgrade.upgradetask.EmbeddedCrowdMembershipAggregationUpgradeTask.runOnSpaceImport]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT (Session #472699016)
        [com.atlassian.confluence.upgrade.upgradetask.EmbeddedCrowdMembershipAggregationUpgradeTask.getBuildNumber]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #734477673)
        [com.atlassian.confluence.upgrade.upgradetask.EmbeddedCrowdMembershipAggregationUpgradeTask.getShortDescription]: PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly (Session #440486754)
 -- url: /spaces/doexportspace.action | referer: http://10.125.91.230:8090/spaces/exportspacexml.action?key=SO | traceId: bfffe08bb52b53d2 | userName: admin | action: doexportspace
2020-06-17 21:02:37,072 ERROR [Long running task: Export Space] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "Export Space" failed to run.
 -- url: /spaces/doexportspace.action | referer: http://10.125.91.230:8090/spaces/exportspacexml.action?key=SO | traceId: bfffe08bb52b53d2 | userName: admin | action: doexportspace
org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:873)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:710)
    at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
    at com.sun.proxy.$Proxy213.commit(Unknown Source)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:152)
    at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:68)
    at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)
    at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:39)
    at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
2020-06-17 21:02:37,072 WARN [Long running task: Export Space] [confluence.util.profiling.DefaultActivityMonitor] close Exceeded the threshold of 60000 ms: ActivitySnapshot{startTime=1592424992867, threadId=2116, threadName='Long running task: Export Space', userId='', type='long-running-task', summary='Export Space'}
 -- url: /spaces/doexportspace.action | referer: http://10.125.91.230:8090/spaces/exportspacexml.action?key=SO | traceId: bfffe08bb52b53d2 | userName: admin | action: doexportspace


Adding DEBUG to the following classes don't unveil anything different that could be causing an issue.

com.atlassian.confluence.importexport
com.atlassian.confluence.pages.persistence.dao
com.atlassian.hibernate.extras.XMLDatabinder


Confluence Home directory is part of an ext3 File System, or ext4 without dir_index and dir_nlink features enabled.


If you are reaching the problem described in this KB, there won't be any other meaningful message in the application logs because of CONFSERVER-59957 - Getting issue details... STATUS

Cause

Some file system types has a limitation on the number of subdirectories as detailed in the below table.

File systemext3ext4GFSGFS2XFS
Maximum subdirectories32,000

65,000/unlimited*

unlimitedunlimitedunlimited
*ext4 is unlimited when dir_index and dir_nlink features are enabled.


When exporting a Space, Confluence will copy the attachments from the <confluence-home>/attachments/ver003/ directory structure to <confluence-home>/temp/xmlexport-<date>/attachments/, which is a temporary directory used to store the exported content before compressing in a zip file.

Depending on the number of pages with at least one attachment, Confluence may surpass the maximum number of subdirectories in <confluence-home>/temp/xmlexport-<date>/attachments/.

For example, when <confluence-home> is mounted with an ext3 file system, this limitation is surpassed if the Space has more than 32,000 pages with an attachment each.

Solution

If <confluence-home> is mounted on an ext3 File System, work with internal teams to migrate it to a File System with unlimited support for subdirectories.

If using ext4, make sure dir_index and dir_nlink features are enabled.


If still facing issues while exporting the Space, please contact the support team.

See Also

Hierarchical File System Attachment Storage

Red Hat Enterprise Linux technology capabilities and limits

ext4 - Unlimited number of subdirectories


Last modified on Jul 9, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.