Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-9909

Duplicate key violation on "definitions" table [data_index]

XMLWordPrintable

      Environment: using platform artifacts from main branch, with embedded postgres, data index and job services.

      While running SWF instances that contain a callback state, the framework attempts to insert more than once the SWF entry in the definitions table of the `data_index` database.

      DB status before running another instanceof ticket-escalation SWF:

      data_index=# select id from definitions;
               id         
      --------------------
       ticket-escalation2
       hello
       ticket-escalation

      Log messages after the new instance is triggered:

      2023-10-23 09:08:19,779 dmartino-mac INFO  [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:64] (executor-thread-16) Triggered node 'approvalEvent' for process 'ticket-escalation' (fa669882-13e5-41c5-a3c2-6f50cb013294)
      2023-10-23 09:08:19,780 dmartino-mac INFO  [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:50] (executor-thread-16) Workflow 'ticket-escalation' (fa669882-13e5-41c5-a3c2-6f50cb013294) was started, now 'Active'
      2023-10-23 09:08:19,821 dmartino-mac WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper:137] (executor-thread-16) SQL Error: 0, SQLState: 23505
      2023-10-23 09:08:19,821 dmartino-mac ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper:142] (executor-thread-16) ERROR: duplicate key value violates unique constraint "definitions_pkey"
        Detail: Key (id, version)=(ticket-escalation, 0.0.1) already exists.

      As a result, the client invoking the POST request receives 500 error:

      < HTTP/1.1 500 Internal Server Error
      < Content-Type: application/json
      < Content-Length: 44
      < 
      * Connection #0 to host localhost left intact
      {"message":"Error invoking subclass method"}

      Example SWF attached.

      Snippet of log attached.

       

        1. duplicatedKey.log
          32 kB
          Daniele Martinoli
        2. ticketEscalation.sw.yaml
          3 kB
          Daniele Martinoli

              tdolphin-1 Tiago Dolphine (Inactive)
              dmartino@redhat.com Daniele Martinoli
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: