Skip to content

Duplicate key errors when creating targets #3010

@Fourkane

Description

@Fourkane

We're running Hawkbit version: 0.3.0 with Postgres database.

When multiple concurrent API requests arrive at the same time to create targets (POST /rest/v1/targets), Hawkbit fails when targets already exist and a SQL error is thrown instead fo handling the conflict (unique constraint violation error). Hawkbit does not recover and CPU/Memory usage spikes.

Database errors:
`[hawkbit:7513]ERROR: current transaction is aborted, commands ignored until end of transaction block
[hawkbit:7513]STATEMENT: SELECT 1
[hawkbit:7513]ERROR: duplicate key value violates unique constraint "uk_tenant_controller_id_sp_target"
[hawkbit:7513]DETAIL: Key (controller_id, tenant)=(AAAA-1111, DEFAULT) already exists.

[hawkbit:7513]STATEMENT: INSERT INTO sp_target (address, controller_id, created_at, created_by, description, install_date, last_modified_at, last_modified_by, last_target_query, name, optlock_revision, request_controller_attributes, sec_token, update_status, assigned_distribution_set, installed_distribution_set, target_type, tenant) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $ │
│ 12, $13, $14, $15, $16, $17, $18) `

spring.log does have some errors as well but don't think are related to target creation issue:

`2026-04-09 17:26:58.980 ERROR 1 --- [http-nio-8080-exec-187] o.a.c.c.C.[.[.[.[vaadin4SpringServlet] : Servlet.service() for servlet [vaadin4SpringServlet] in context with path [/hawkbit] threw exception [com.vaadin.server.ServiceException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe] with root cause

java.io.IOException: Broken pipe`

Thanks for your feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions