Unable to save or edit pages
Asked by Anatoly Fishgang:

When trying to save a new page or edit an existing one,

Getting the following in UI
> "This page is taking longer to load than usual. Give it a few moments, then try refreshing. Still having issues? Contact your Confluence admin."

```
2019-10-16 18:05:12,401 DEBUG [414:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"entity":"/Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651253","ns":"synchrony.sync.hub","throwable":"com.mysema.query.QueryException: Caught BatchUpdateException for insert into \"EVENTS\" (\"history\", \"rev\", \"partition\", \"sequence\", \"event\") values (?, ?, ?, ?, ?)\n\tat com.mysema.query.sql.DefaultSQLExceptionTranslator.translate(DefaultSQLExceptionTranslator.java:38)\n\tat com.mysema.query.sql.Configuration.translate(Configuration.java:514)\n\tat com.mysema.query.sql.dml.SQLInsertClause.execute(SQLInsertClause.java:380)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)\n\tat synchrony.querydsl.history_store.QueryDslHistoryStore$fn__55905.invoke(history_store.clj:112)\n\tat clojure.core.async$thread_call$fn__6519.invoke(async.clj:439)\n\tat synchrony.data.(take?)(data.clj:364)\n\tat synchrony.data$put_revisions_no_limit_BANG_$fn__39256.invoke(data.clj:361)\n\tat synchrony.data.(take?)(data.clj:413)\n\tat synchrony.data$put_revisions_BANG_$fn__39314.invoke(data.clj:384)\n\tat synchrony.data.(take?)(data.clj:782)\n\tat synchrony.data$put_revisions_ensure_snapshot_BANG_$fn__41126.invoke(data.clj:770)\n\tat synchrony.data.(take?)(data.clj:810)\n\tat synchrony.data$put_revisions_partitioning_BANG_$fn__41189.invoke(data.clj:801)\n\tat synchrony.sync.hub.(take?)(hub.clj:330)\n\tat synchrony.sync.hub$init_in_new_state$fn__42437.invoke(hub.clj:315)\n\tat synchrony.sync.hub.(take?)(hub.clj:576)\n\tat synchrony.sync.hub$process_merge_into_master$fn__43238.invoke(hub.clj:561)\n\tat synchrony.sync.hub.(take?)(hub.clj:599)\n\tat synchrony.sync.hub$fn__43275$fn__43309.invoke(hub.clj:591)\n\tat synchrony.sync.hub.(take?)(hub.clj:762)\n\tat synchrony.sync.hub$process_message$fn__44230.invoke(hub.clj:754)\n\tat clojure.lang.AFn.run(AFn.java:22)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: java.sql.BatchUpdateException: Batch entry 0 insert into \"EVENTS\" (\"history\", \"rev\", \"partition\", \"sequence\", \"event\") values ('/Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651253', 'confluence$content$10651253.5', 0, 0, ?) was aborted: ERROR: null value in column \"contentid\" violates not-null constraint\n Detail: Failing row contains (confluence$content$10651253.5, /Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651..., 0, 0, \\x01934493469301914a9147c44593429201961e9420bb636f6e666c75656e63..., null, null). Call getNextException to see other errors in the batch.\n\tat org.postgresql.jdbc.BatchResultHandler.handleCompletion(BatchResultHandler.java:166)\n\tat org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:483)\n\tat org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:791)\n\tat org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1547)\n\tat com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544)\n\tat com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:161)\n\tat com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:171)\n\tat com.mysema.query.sql.dml.SQLInsertClause.execute(SQLInsertClause.java:374)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)\n\tat clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:313)\n\tat synchrony.querydsl.history_store.QueryDslHistoryStore$fn__55905.invoke(history_store.clj:112)\n\tat clojure.core.async$thread_call$fn__6519.invoke(async.clj:439)\n\t... 4 more\nCaused by: org.postgresql.util.PSQLException: ERROR: null value in column \"contentid\" violates not-null constraint\n Detail: Failing row contains (confluence$content$10651253.5, /Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651..., 0, 0, \\x01934493469301914a9147c44593429201961e9420bb636f6e666c75656e63..., null, null).\n\tat org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2476)\n\tat org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2189)\n\tat org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:472)\n\t... 18 more\n","message":"synchrony.sync.hub [warn] Caught BatchUpdateException for insert into \"EVENTS\" (\"history\", \"rev\", \"partition\", \"sequence\", \"event\") values (?, ?, ?, ?, ?)","level":"warn"}}
2019-10-16 18:05:12,405 DEBUG [414:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"message":"synchrony.http.entity-api [warn] Error in put-entity","entity":"/Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651253","id":"W6Kc9TmE-jmDBf7YXv5sgg","ns":"synchrony.http.entity-api","throwable":"clojure.lang.ExceptionInfo: Caught BatchUpdateException for insert into \"EVENTS\" (\"history\", \"rev\", \"partition\", \"sequence\", \"event\") values (?, ?, ?, ?, ?) {:type :server-error, :source :server}\n\tat clojure.core$ex_info.invokeStatic(core.clj:4725)\n\tat synchrony.sync.messages$ex_info_from_error_message.invokeStatic(messages.cljc:29)\n\tat synchrony.sync.connection$request_BANG_$fn__31271.invoke(connection.cljc:92)\n\tat synchrony.http.entity-api.(take?)(entity_api.clj:493)\n\tat synchrony.http.entity_api$content_reconciliation$fn__48540.invoke(entity_api.clj:472)\n\tat synchrony.http.entity-api.(take?)(entity_api.clj:536)\n\tat synchrony.http.entity_api$put_revision_handler$fn__48739.invoke(entity_api.clj:518)\n\tat clojure.lang.AFn.run(AFn.java:22)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n","level":"warn"}}
2019-10-16 18:05:12,405 DEBUG [414:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"request":{"remote-addr":"172.19.0.1","uri":"/synchrony/v1/data/Synchrony-21b6e24b-0b8c-3e34-aca1-0dbfaa652781/confluence-10651253","request-method":"post","query-string":"optimistic=true&rewrite-request=true","x-forwarded-for":"51.15.81.8"},"response":{"status":400},"ns":"synchrony.middleware.logging","level":"info","message":"synchrony.middleware.logging [info] null"}}
2019-10-16 18:05:14,394 DEBUG [414:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"request":{"remote-addr":"127.0.0.1","uri":"/synchrony/heartbeat","request-method":"get","query-string":null},"response":{"status":200},"ns":"synchrony.middleware.logging","level":"info","message":"synchrony.middleware.logging [info] null"}}
2019-10-16 18:05:19,401 DEBUG [414:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"request":{"remote-addr":"127.0.0.1","uri":"/synchrony/heartbeat","request-method":"get","query-string":null},"response":{"status":200},"ns":"synchrony.middleware.logging","level":"info","message":"synchrony.middleware.logging [info] null"}}
```

Disabling Synchrony in Collaborative editing helps to resolve the issue temporarily


Answers:
author: Andrew Laden
body: So it looks like Synchrony is having a problem.

Did you try bouncing confluence? If synchrony is hung up, thats probably the easiest way to fix it.

What does your "instance health check" say under troubleshooting and support tools.

If you did that already. Was this working previously? Did it stop working after some change.

Getting the synchrony setup can be tricky if you are using things like reverse proxies, ssl etc.

comments: author: Kiran Panduga {Appfire}
body: Yes, this is synchrony issue.

Check whether the synchrony heartbeat is responding by accessing your Confluence

[https://\<confluenceURL\>/synchrony/heartbeat]()(should return OK)

[https://\<confluenceURL\>/synchrony/synchrony/jwt-key]()(should return the jwt-key from confluence.cfg.xml file)

If the heartbeat fails, advise to review the below Atlassian KB articles and check the Synchrony configuration.

<https://confluence.atlassian.com/doc/troubleshooting-collaborative-editing-858772087.html>

<https://confluence.atlassian.com/confkb/collaborative-editing-and-synchrony-troubleshooting-858584399.html>

Thanks,

Kiran.


author: Anatoly Fishgang
body: Hearbeat returns ok

as well as in the logs:

```
2019-10-17 07:55:56,262 DEBUG [173:StdOutHandler [/opt/java/openjdk/bin/java]] {"synchrony":{"request":{"remote-addr":"127.0.0.1","uri":"/synchrony/heartbeat","request-method":"get","query-string":null},"response":{"status":200},"ns":"synchrony.middleware.logging","level":"info","message":"synchrony.middleware.logging [info] null"}}
```

but the **jwt-key**

```
{"message":"Not Found"}
```

I've checked the**confluence.cfg.xml**

and have the key private and public property keys.

```
...
<property name="jwt.private.key">....<//property>
<property name="jwt.public.key">....<//property>
...
<property name="synchrony.encryption.disabled">true</property>
<property name="synchrony.proxy.enabled">true</property
```

I've tried to recreating the jwt keys,

via the following:

<https://confluence.atlassian.com/confkb/confluence-cannot-connect-to-synchrony-due-to-error-validating-jwt-935899880.html>

but still getting the same {"message":"Not Found"}

and Tried the troubleshooting but no luck finding any solution yet.


Tags: confluence-server

server