Confluence daily backup unsuccessfully
Asked by John.Lee:

**Update:when I choose NOT backup attachment in daily backup manage, and when I run the backup is OK,BUT I don't know What's happening?**

I use Confluence daily backup function to backup. but is failed

AND I try to follow the official guidelines, open DEBUG LOG:

<https://confluence.atlassian.com/doc/troubleshooting-failed-xml-site-backups-149212.html>

BUT there is nothing about DEBUG content and I found some ERROR log

How can I fix this issue?Thanks!

```
2019-01-21 23:39:12,857 ERROR [Caesium-1-2] [engine.jdbc.spi.SqlExceptionHelper] logExceptions Connection is read-only. Queries leading to data modification are not allowed
2019-01-21 23:39:12,896 WARN [Caesium-1-2] [persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier] copy Failed to flush session after copying attachment batch.
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
 at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
 at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155)
 at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)
 at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1434)
 at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1414)
 at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:770)
 at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupAttachments(FileXmlExporter.java:161)
 at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupEverything(FileXmlExporter.java:99)
 at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.doExport(AbstractXmlExporter.java:92)
 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.DefaultImportExportManager.doExport(DefaultImportExportManager.java:225)
 at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:191)
 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:302)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
 at com.sun.proxy.$Proxy152.exportAs(Unknown Source)
 at com.atlassian.confluence.importexport.impl.BackupJob.runJob(BackupJob.java:62)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.doRunJob(JobRunnerWrapper.java:120)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.lambda$runJob$0(JobRunnerWrapper.java:91)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.runJob(JobRunnerWrapper.java:91)
 at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
 at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
 at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34)
 at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement
 at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
 at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
 at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
 at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208)
 at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
 at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3003)
 at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3503)
 at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
 at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:586)
 at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:460)
 at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
 at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
 at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1428)
 ... 40 more
Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
 at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2089)
 at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058)
 at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5158)
 at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2043)
 at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
 at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:205)
 ... 49 more
```

```
2019-01-21 23:58:23,372 WARN [Caesium-1-2] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doCommit Commit failed. Rolling back. Error: Could not commit Hibernate transaction; nested exception is net.sf.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit
2019-01-21 23:58:23,375 ERROR [Caesium-1-2] [confluence.importexport.impl.BackupJob] runJob Error while running the scheduled backup
org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is net.sf.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit
 at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:514)
 at com.atlassian.confluence.impl.hibernate.ConfluenceHibernateTransactionManager.doCommit(ConfluenceHibernateTransactionManager.java:69)
 at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
 at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
 at sun.reflect.GeneratedMethodAccessor64.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:302)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
 at com.sun.proxy.$Proxy53.commit(Unknown Source)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
 at com.sun.proxy.$Proxy152.exportAs(Unknown Source)
 at com.atlassian.confluence.importexport.impl.BackupJob.runJob(BackupJob.java:62)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.doRunJob(JobRunnerWrapper.java:120)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.lambda$runJob$0(JobRunnerWrapper.java:91)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
 at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.runJob(JobRunnerWrapper.java:91)
 at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
 at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
 at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285)
 at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59)
 at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34)
 at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit
 at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:217)
 at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
 at com.atlassian.hibernate.adapter.adapters.TransactionV2Adapter.commit(TransactionV2Adapter.java:30)
 at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:510)
 ... 33 more
2019-01-21 23:58:23,378 WARN [Caesium-1-2] [impl.schedule.caesium.JobRunnerWrapper] runJob Scheduled job BackupJob#BackupJob-runNow-1548082404124 completed unsuccessfully with response JobRunnerResponse[runOutcome=FAILED,message='TransactionSystemException: Could not commit Hibernate transaction; nested exception is net.sf.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit
TransactionException: Transaction was marked for rollback only; cannot c']
```


Answers:
author: Nic Brough -Adaptavist-
body: I think you've run into a problem with your database - <https://confluence.atlassian.com/confkb/unable-to-start-due-to-net-sf-hibernate-exception-genericjdbcexception-cannot-open-connection-128843899.html> might be a good starting point

comments: author: John.Lee
body: First thank you!

I think the database is running normally,the system and other functions are also normal.

Even if I manually click on the backup system, it fails :(


author: Nic Brough -Adaptavist-
body: The problem here is that your logs are telling you that the database is failing when you run a backup. Other functions working ok is irrelevant, the error is in the database.

My best guess is that it is a problem when the database is being hit rapidly and repeatedly in order to do something like an export or backup. You'll need to work through the doc I linked to earlier to try to find out if this is the case and what to do about it.


author: John.Lee
body: I try to choose NOT backup attachment in daily backup manage and backup is OK

BUT I don't know What's happening in database? Why backup attachments are related to the database.


author: Nic Brough -Adaptavist-
body: My best guess is that it is a problem when the database is being hit rapidly and repeatedly in order to do something like an export or backup. You'll need to work through the doc I linked to earlier to try to find out if this is the case and what to do about it.


Tags: backup

confluence-administration

confluence-server

server