-
Type:
Hot Fix Request
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 5.2.1
-
Component/s: ACS REST API
-
Labels:
-
Bug Priority:
-
Hot Fix Version:5.2.1.6
-
ACT Numbers:
01005601
-
Premier Customer:Yes
-
Delivery Team:Customer Excellence
When using the Downloads REST API endpoint in an Alfresco instance with MS SQL Server as DB, it fails giving a "Snapshot isolation transaction aborted due to update conflict" error.
This is the downloads api endpoint failing:
https://api-explorer.alfresco.com/api-explorer/#!/downloads/createDownload
Steps to reproduce:
- In a vanilla instance, get the noderef of any document. (For example one of the documents of the default site swsdp).
- Use the Downloads REST API to download as a zip the document from step 1:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -u admin:admin -d '{"nodeIds":["150398b3-7f82-4cf6-af63-c450ef6c5eb8"]}' "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/downloads"
Expected behaviour
ZIP node is created and node-id returned in a JSON:
{"entry":{"filesAdded":0,"bytesAdded":0,"totalBytes":0,"id":"aea16cc0-21b1-4d23-b0ba-7e16d4ef687e","totalFiles":0,"status":"PENDING"}}
Observed behaviour
Following error is returned:
{"error":{"errorKey":"framework.exception.ApiDefault","statusCode":500,"briefSummary":"Failed to update node 1595; nested exception is org.springframework.jdbc.UncategorizedSQLException: \n### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.alf_node' directly or indirectly in database 'alfrescodb' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.\n### The error may involve alfresco.node.update_Node-Inline\n### The error occurred while setting parameters\n### SQL: update alf_node set version = ? , transaction_id = ? , audit_creator = ? , audit_created = ? , audit_modifier = ? , audit_modified = ? , audit_accessed = ? where id = ? and version = (? - 1)\n### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.alf_node' directly or indirectly in database 'alfrescodb' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.\n; uncategorized SQLException for SQL []; SQL state [S0003]; error code [3960]; Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.alf_node' directly or indirectly in database 'alfrescodb' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.alf_node' directly or indirectly in database 'alfrescodb' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.","stackTrace":"For security reasons the stack trace is no longer displayed, but the property is kept for previous versions","descriptionURL":"https://api-explorer.alfresco.com","logId":"988a7644-bad6-4111-a201-8dbbdece57f1"}}
Note: if the error doesn't happen in the first attempt, try a few times including restarting Alfresco.