DependencyTrack / DependencyTrack/dependency-track

ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"

Open
#582 5 comments 0 reactions 0 assignees View on GitHub
in triage
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior:
Whilst performing issue triage (eg, attaching a comment in threat audit), there was a lack of system response followed by a 500 Error dialog.

### Steps to Reproduce:
This incident occurrred just once so far.

Whilst performing triage of a threat I typed in a comment and attempted to save it... and nothing seemed to happen (comment was not saved).

I clicked save a couple of times and then attempted to set the status and attempted to suppress the threat. Nothing happened for either action.

The 500 error then popped up (although I cannot recall if it was straight away or as I tried to reload the screen or similar).

The logs show that there were multiple WARN events about constraint violations occurring due to a key already existing. I am guessing that my first attempt to save a comment actually did something and that the logged events relate to my subsequent clicks.

### Expected Behavior:

Suggest that the system should provide dynamic feedback to inform the user that the request (button click) was accepted and is being processed.

### Environment:

- Dependency-Track Version: 3.7.1
- Distribution: [ Executable WAR ]
- BOM Format & Version: CycloneDX 1.1
- Database Server: [ PostgreSQL ]
- Browser: Firefix 72.0.2

### Additional Details:

```
2020-02-06 11:09:33,563 [] INFO [org.dependencytrack.tasks.MetricsUpdateTask] Executing metrics update for project: 737c8e22-7447-4360-b73c-689991ca8725
2020-02-06 11:09:40,040 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@2fcb54b6" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,040 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@e92b96e" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,040 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@e266c81" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,040 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@2d7da201" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,041 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,041 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,041 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@32ae0d92" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,041 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@283d1598" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,041 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,041 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,041 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,042 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,042 [] WARN [DataNucleus.Datastore.Persist] Insert of object "org.dependencytrack.model.Analysis@12562662" using statement "INSERT INTO "ANALYSIS" ("STATE","COMPONENT_ID","PROJECT_ID","SUPPRESSED","VULNERABILITY_ID") VALUES (?,?,?,?,?)" failed : ERROR: duplicate key value violates unique constraint "ANALYSIS_COMPOSITE_IDX"
Detail: Key ("PROJECT_ID", "COMPONENT_ID", "VULNERABILITY_ID")=(367, 366, 66252) already exists.
2020-02-06 11:09:40,042 [] WARN [DataNucleus.General] ExecutionContext closed with active transaction, so rolling back the active transaction
2020-02-06 11:09:40,207 [] ERROR [DataNucleus.Transaction] Operation commit failed on resource: org.datanucleus.store.rdbms.ConnectionFactoryImpl$EmulatedXAResource@548fc1b9, error code UNKNOWN and transaction [DataNucleus Transaction, ID=-1242486613-7547697, enlisted resources=[org.datanucleus.store.rdbms.ConnectionFactoryImpl$EmulatedXAResource@548fc1b9]] : ERROR: update or delete on table "PROJECT" violates foreign key constraint "ANALYSIS_FK2" on table "ANALYSIS"
Detail: Key (ID)=(367) is still referenced from table "ANALYSIS".
2020-02-06 11:09:58,641 [] INFO [org.dependencytrack.tasks.MetricsUpdateTask] Completed metrics update for project: 737c8e22-7447-4360-b73c-689991ca8725
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.