Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-79099

Webhook historian causes primary key constraint violation in Data Center products

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 10.0.0, 10.3.0, 10.3.10, 11.0.1
    • Webhooks
    • None

      Issue Summary

      Since Jira Data Center 10.0 (Atlassian Webhooks 6.1+), webhook invocation history (headers/body/timing) and counts (success/failures/errors) are stored in the AO_A0B856_HIST_INVOCATION and AO_A0B856_DAILY_COUNTS database tables, respectively. This functionality primarily exists for Bitbucket DC and Confluence DC, but the data can still be queried from Jira's database for troubleshooting and statistics.

      In customer environments with extraordinary webhook usage, concurrent non-atomic operations may attempt to update the AO_A0B856_HIST_INVOCATION table simultaneously. While this does not impact webhook delivery and is typically self-repairing, this produces log errors and may mildly skew statistics.

      Steps to Reproduce

      Atlassian Support hasn't successfully reproduced this behavior. It was directly observed in a customer's environment with ~300 webhook configurations and 65k users.

      Expected Results

      Webhook invocation history is persisted without any errors.

      Actual Results

      The following error periodically appears in the atlassian-jira.log (PostgreSQL example):

      2025-08-20 17:00:00,000+0000 atlassian-webhooks-scheduler:thread-1 WARN      [c.a.w.internal.dao.AsyncInvocationHistoryDao] Failed to write webhook invocation data for 200:jira:issue_updated to the database
      com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
      org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "AO_A0B856_HIST_INVOCATION_pkey"
        Detail: Key ("ID")=(200.jira:issue_updated.global.S) already exists.
      	at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:104)
      	at com.atlassian.activeobjects.osgi.ActiveObjectsDelegate.create(ActiveObjectsDelegate.java:246)
      	[reflections/Spring]
      	at com.atlassian.webhooks.internal.dao.AoInvocationHistoryDao.saveInvocation(AoInvocationHistoryDao.java:384)
      	at com.atlassian.webhooks.internal.dao.AsyncInvocationHistoryDao.maybeFlush(AsyncInvocationHistoryDao.java:296)
      	at com.atlassian.webhooks.internal.dao.AsyncInvocationHistoryDao.lambda$flushPending$7(AsyncInvocationHistoryDao.java:262)
      	[reflections/Spring]
      	at com.atlassian.webhooks.internal.dao.AsyncInvocationHistoryDao.flushPending(AsyncInvocationHistoryDao.java:259)
      	at com.atlassian.webhooks.internal.dao.AsyncInvocationHistoryDao.flush(AsyncInvocationHistoryDao.java:216)
      	at com.atlassian.webhooks.internal.dao.AsyncInvocationHistoryDao.flushAndReschedule(AsyncInvocationHistoryDao.java:247)
      	[executor service]
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "AO_A0B856_HIST_INVOCATION_pkey"
        Detail: Key ("ID")=(200.jira:issue_updated.global.S) already exists.
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
      	[AO/DBCP2]
      	at net.java.ao.EntityManager.create(EntityManager.java:450)
      	at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:102)
      	... 66 more
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available.

              Unassigned Unassigned
              1353e2e9fd2f Benjamin S
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: