Getting Error: Unable to communicate with server. Saving is not possible at the moment.
Asked by Simon Pretty:

Hi,

I'm getting following error: "Unable to communicate with server. Saving is not possible at the moment."

There's nothing obvious in /var/atlassian/application-data/confluence/logs/atlassian-confluence.log. Nothing actually appears in log when the error apears. Tried Firefox and Chrome in both normal and incognito mode. I tried to disable collaborative editing. Nothing worked. One of the articles that I'm trying to publish has only text without any special characters in it and a simple table of content.

We're running version 7.5.1. Didn't seem to have this issue in v6 that we upgraded from recently. However, we didn't put a lot of content in v6, so I can't guarantee that the upgrade broke it.

We're not using proxy either.

//EDIT

These are some logs that appear after a while which might indicate the cause of the issue:

"2020-06-18 12:37:10,192 INFO \[Caesium-1-4\] \[atlassian.crowd.directory.DbCachingRemoteDirectory\] synchroniseCache INCREMENTAL synchronisation complete for directory \[ 98306 \] in \[ 630ms \]  
2020-06-18 12:43:10,993 ERROR \[http-nio-8090-exec-3\] \[engine.jdbc.spi.SqlExceptionHelper\] logExceptions Violation of UNIQUE KEY constraint 'u2c_relation_unique'. Cannot insert duplicate key in object 'dbo.USERCONTENT_RELATION'. The duplicate key value is (6193344, 4028048270aa806c0170aa92d98d0004, touched).  
-- referer: http://wiki:8090/pages/resumedraft.action?draftId=6193344\&draftShareId=abf1e631-d708-4866-ad24-989d8f7b3393\& \| url: /rest/tinymce/1/drafts \| traceId: 39b80c86eb414e7b \| userName: XXXXXXX  
2020-06-18 12:43:10,994 ERROR \[http-nio-8090-exec-3\] \[org.hibernate.internal.ExceptionMapperStandardImpl\] mapManagedFlushFailure HHH000346: Error during managed flush \[org.hibernate.exception.ConstraintViolationException: could not execute statement\]  
-- referer: http://wiki:8090/pages/resumedraft.action?draftId=6193344\&draftShareId=abf1e631-d708-4866-ad24-989d8f7b3393\& \| url: /rest/tinymce/1/drafts \| traceId: 39b80c86eb414e7b \| userName: XXXXXXX  
2020-06-18 12:43:13,856 WARN \[http-nio-8090-exec-3\] \[confluence.impl.hibernate.ConfluenceHibernateTransactionManager\] doCommit Commit failed. Rolling back. Error: Hibernate operation: could not execute statement; sql=n/a; Violation of UNIQUE KEY constraint 'u2c_relation_unique'. Cannot insert duplicate key in object 'dbo.USERCONTENT_RELATION'. The duplicate key value is (6193344, 4028048270aa806c0170aa92d98d0004, touched).; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Violation of UNIQUE KEY constraint 'u2c_relation_unique'. Cannot insert duplicate key in object 'dbo.USERCONTENT_RELATION'. The duplicate key value is (6193344, 4028048270aa806c0170aa92d98d0004, touched).  
-- referer: http://wiki:8090/pages/resumedraft.action?draftId=6193344\&draftShareId=abf1e631-d708-4866-ad24-989d8f7b3393\& \| url: /rest/tinymce/1/drafts \| traceId: 39b80c86eb414e7b \| userName: XXXXXXX  
2020-06-18 12:43:13,857 WARN \[http-nio-8090-exec-3\] \[confluence.impl.hibernate.ConfluenceHibernateTransactionManager\] doRollback Performing rollback. Transactions:  
-\>\[com.atlassian.confluence.api.impl.service.relation.RelationServiceImpl.create\]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #372414811)  
-- referer: http://wiki:8090/pages/resumedraft.action?draftId=6193344\&draftShareId=abf1e631-d708-4866-ad24-989d8f7b3393\& \| url: /rest/tinymce/1/drafts \| traceId: 39b80c86eb414e7b \| userName: XXXXXXX  
2020-06-18 12:43:13,858 ERROR \[http-nio-8090-exec-3\] \[rest.api.model.ExceptionConverter\] convertServiceException No status code found for exception, converting to internal server error :  
-- referer: http://wiki:8090/pages/resumedraft.action?draftId=6193344\&draftShareId=abf1e631-d708-4866-ad24-989d8f7b3393\& \| url: /rest/tinymce/1/drafts \| traceId: 39b80c86eb414e7b \| userName: XXXXXXX  
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute statement; sql=n/a; Violation of UNIQUE KEY constraint 'u2c_relation_unique'. Cannot insert duplicate key in object 'dbo.USERCONTENT_RELATION'. The duplicate key value is (6193344, 4028048270aa806c0170aa92d98d0004, touched).; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Violation of UNIQUE KEY constraint 'u2c_relation_unique'. Cannot insert duplicate key in object 'dbo.USERCONTENT_RELATION'. The duplicate key value is (6193344, 4028048270aa806c0170aa92d98d0004, touched)."

Any suggestions?


Answers:
author: Simon Pretty
body: Rebuilding indexes from scratch did not help either. Any suggestions?