ERROR: duplicate key value violates unique constraint "documents_size_statistics_pk"

We see a lot of these errors. Is this a known bug? A problem with postgres? Is UUID generation related to the hostname?

2016-12-02 09:59:43,862 ERROR [ajp-bio-127.0.0.1-8009-exec-32] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exce
ption during quotaStatsListener sync listener execution, continuing to run other listeners
org.nuxeo.ecm.core.api.ConcurrentUpdateException: Failed to save session, java.sql.BatchUpdateException: Batch-Eintr
ag 0 INSERT INTO "documents_size_statistics" ("id", "innersize", "sizetrash", "maxsize", "totalsize", "sizeversions"
) VALUES ('956b5657-d824-4b38-8828-dd6810ca324b', NULL, NULL, NULL, 30043, NULL) wurde abgebrochen.  Rufen Sie 'getN
extException' auf, um die Ursache zu erfahren.
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCConnection.checkConcurrentUpdate(JDBCConnection.java:189)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.insertSimpleRows(JDBCRowMapper.java:576)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.writeCreates(JDBCRowMapper.java:479)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.write(JDBCRowMapper.java:448)
        at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.doInvoke(JDBCMapperConnector.java:42)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.invoke(JDBCMapperConnector.java:85)
        at com.sun.proxy.$Proxy54.write(Unknown Source)
        at org.nuxeo.ecm.core.storage.sql.SoftRefCachingRowMapper.write(SoftRefCachingRowMapper.java:359)
        at org.nuxeo.ecm.core.storage.sql.SessionImpl.doFlush(SessionImpl.java:361)
        at org.nuxeo.ecm.core.storage.sql.SessionImpl.flush(SessionImpl.java:334)
        at org.nuxeo.ecm.core.storage.sql.SessionImpl.save(SessionImpl.java:313)
        at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.save(ConnectionImpl.java:174)
        at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.save(SQLSession.java:142)
        at org.nuxeo.ecm.core.api.AbstractSession.save(AbstractSession.java:1413)
        at org.nuxeo.ecm.quota.count.DocumentsCountUpdater.updateCountStatistics(DocumentsCountUpdater.java:154)
        at org.nuxeo.ecm.quota.count.DocumentsCountUpdater.processDocumentCreated(DocumentsCountUpdater.java:67)
        at org.nuxeo.ecm.quota.AbstractQuotaStatsUpdater.updateStatistics(AbstractQuotaStatsUpdater.java:110)
        at org.nuxeo.ecm.quota.QuotaStatsServiceImpl$1.run(QuotaStatsServiceImpl.java:101)
        at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:131)
        at org.nuxeo.ecm.quota.QuotaStatsServiceImpl.updateStatistics(QuotaStatsServiceImpl.java:104)
        at org.nuxeo.ecm.quota.QuotaStatsListener.handleEvent(QuotaStatsListener.java:76)
        at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:200)
        at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:275)
        at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:710)
        at org.nuxeo.ecm.platform.filemanager.service.extension.AbstractFileImporter.create(AbstractFileImporter.java:236)
        at org.nuxeo.ecm.platform.filemanager.service.FileManagerService.createDocumentFromBlob(FileManagerService.java:218)
        at org.nuxeo.drive.adapter.impl.DocumentBackedFolderItem.createFile(DocumentBackedFolderItem.java:484)
        at org.nuxeo.drive.service.impl.FileSystemItemManagerImpl.createFile(FileSystemItemManagerImpl.java:240)
        at org.nuxeo.drive.operations.NuxeoDriveCreateFile.run(NuxeoDriveCreateFile.java:73)
        at sun.reflect.GeneratedMethodAccessor1131.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:171)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:177)
...
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "documents_size_statistics_pk"
  Detail: Key (id)=(956b5657-d824-4b38-8828-dd6810ca324b) already exists.
...

Caused by: java.sql.BatchUpdateException: Batch-Eintrag 0 INSERT INTO "hierarchy" ("id", "parentid", "pos", "name",
"isproperty", "primarytype", "mixintypes", "ischeckedin", "baseversionid", "majorversion", "minorversion", "isversio
n") VALUES ('f2dcba4b-2b37-418c-8e3c-14c88227674a', '62b42aea-8044-4e48-a4c6-f4e986500cf8', NULL, 'thumb:thumbnail',
 '1', 'content', NULL, NULL, NULL, NULL, NULL, NULL) wurde abgebrochen.  Rufen Sie 'getNextException' auf, um die Ur
sache zu erfahren.
        at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:136)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2004)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:360)
        at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:1019)
        at org.tranql.connector.jdbc.StatementHandle.executeBatch(StatementHandle.java:155)
        at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.insertSimpleRows(JDBCRowMapper.java:562)
        ... 147 more
Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of t
ransaction block
...
****** chain ******
Name: NuxeoDrive.CreateFile
Exception: OperationException
Caught error: Failed to invoke operation NuxeoDrive.CreateFile
Caused by: org.nuxeo.ecm.core.api.NuxeoException: Error while trying to create file Students list (initial).xlsx as a child of doc /default-domain/UserWorkspaces/xxxxxx/xxxxx/xx/xxxxx, Could not insert: INSERT INTO "hierarchy" ("id", "parentid", "pos", "name", "isproperty", "primarytype", "mixintypes", "ischeckedin", "baseversionid", "majorversion", "minorversion", "isversion") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2016-12-02 10:00:10,198 ERROR [ajp-bio-127.0.0.1-8009-exec-37] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exception during quotaStatsListener sync listener execution, continuing to run other listeners
org.nuxeo.ecm.core.api.ConcurrentUpdateException: Failed to save session, java.sql.BatchUpdateException: Batch-Eintrag 0 INSERT INTO "documents_count_statistics" ("id", "descendantscount", "childrencount") VALUES ('567424c1-12d4-482e-9f6f-68aa911e0291', 1, 1) wurde abgebrochen.  Rufen Sie 'getNextException' auf, um die Ursache zu erfahren.

Just for that last example, if I query the database now, I get:

# select * from documents_count_statistics where id = '567424c1-12d4-482e-9f6f-68aa911e0291';
                  id                  | descendantscount | childrencount
--------------------------------------+------------------+---------------
 567424c1-12d4-482e-9f6f-68aa911e0291 |               57 |             3
(1 row)

But for hierarchy …

 select * from hierarchy where id = 'f2dcba4b-2b37-418c-8e3c-14c88227674a' ;
 id | parentid | pos | name | isproperty | primarytype | mixintypes | ischeckedin | baseversionid | majorversion | min
orversion | isversion
----+----------+-----+------+------------+-------------+------------+-------------+---------------+--------------+----
----------+-----------
(0 rows)

A minute later, we get our first of 14 deadlock errors detected:

Caused by: org.postgresql.util.PSQLException: ERROR: deadlock detected
  Detail: Process 24312 waits for ShareLock on transaction 2262788; blocked by process 24369.
Process 24369 waits for ShareLock on transaction 2262787; blocked by process 24312.
  Hinweis: See server log for query details.
  Wobei: while inserting index tuple (7314,88) in relation "documents_size_statistics_pk"
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
        ... 161 more
2016-12-02 10:00:00,382 ERROR [ajp-bio-127.0.0.1-8009-exec-6] [org.nuxeo.ecm.automation.server.jaxrs.batch.BatchManagerComponent] Error while executing automation batch
org.nuxeo.ecm.automation.TraceException:

****** chain ******
Name: NuxeoDrive.CreateFile
Exception: OperationException
Caught error: Failed to invoke operation NuxeoDrive.CreateFile
Caused by: org.nuxeo.ecm.core.api.NuxeoException: Error while trying to create file 2016_Blatt_05.pdf as a child of doc /default-domain/UserWorkspaces/xxxxxxxx/xxxxxx/PS/2016WS/Blatt_05, Could not insert: INSERT INTO "hierarchy" ("id", "parentid", "pos", "name", "isproperty", "primarytype", "mixintypes", "ischeckedin", "baseversionid", "majorversion", "minorversion", "isversion") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
0 votes

0 answers

1237 views

ANSWER