Concecutive API calls generate random Internal Server Error 500 org.springframework.transaction
Asked by sebastien.gillet:

We get the following errors while calling the detailed Confluence Cloud API endpoints in batch (tens of calls).

* The calls are made consecutively (errors occurs whatever the delay between 200ms and 5000ms between each call).
* The errors are intermittent: about 50-70% of calls end up with one or the other of the errors.
* The errors occur unevenly, and don't seem to have any logic regarding what call works or not. For instance, in a process deleting all the children Pages of a parent Page, about half of the calls will fail on first execution (deleting about half of the Pages), then about 50% on the remaining pages on the 2nd second call, and so on until all the remaining pages are dseleted.
* On the POST endpoint below, about 75% of the calls fail.

**Error 1:**  
*org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only*  
**Error 2:**   
*org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is net.sf.hibernate.JDBCException: Unable to acquire JDBC Connection*  
**REST API calls generating a random mix of these errors:**  
axios.default.**delete** (\`[\[our domain\]/wiki](https://marss.atlassian.net/wiki)**/rest/api/content/${childPage.id}** \`,  
{  
headers: {  
"Authorization": \`Basic ${TOKEN}\`,  
"Accept": 'application/json',  
"Content-Type": 'application/json'  
}  
});  
axios.default.**post** ('[\[our domain\]](https://marss.atlassian.net/wiki)[/wiki](https://marss.atlassian.net/wiki)**/rest/api/content** ',  
reqBodyData,  
{  
headers: {  
"Authorization": \`Basic ${TOKEN}\`,  
"Accept": 'application/json',  
"Content-Type": 'application/json'  
}  
});  
Please can you advise what triggers those errors and how to run these APIs, at least consecutively, in an efficient manner (i.e. without too much delay between each call), without getting these errors?


Answers:
author: Fabian Lim
body: Hi [@sebastien.gillet](/t5/user/viewprofilepage/user-id/4165921)

Check if you are using any specific plugins in the pages that causes issues: <https://community.atlassian.com/t5/Confluence-questions/Error-Transaction-rolled-back-because-it-has-been-marked-as/qaq-p/1181849>

Also, create a ticket with atlassian support and ask them to analyze the logs.

Regards

comments: author: sebastien.gillet
body: Thank you [@Fabian Lim](/t5/user/viewprofilepage/user-id/3131564)   
We have reported the issue to Atlassian Support and investigating.  
We will post back here when a solution is found.


author: Robert Gottesman
body: I am seeing the same random errors when adding new pages via the Confluence Cloud REST API. The specific HTTP 500 message

*"org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only"*

My case might be slightly different than [@sebastien.gillet](/t5/user/viewprofilepage/user-id/4165921) as the page is actually added hence this seems to be a False/Negative. As mentioned above, these errors are plentiful and inconsistent.

I will be posting this to Atlassian support as well.


Tags: cloud

confluence-cloud