Duplicate key errors when creating targets

Cerrado
#3,010 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
java, postgresql

Línea de trabajo

Start at the POST /rest/v1/targets entry point and trace how concurrent target creation handles the unique constraint in PostgreSQL. Reproduce the issue with simultaneous requests for the same controller ID; done means the conflict is handled without leaving the transaction aborted or causing the reported CPU and memory spike.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
601
Forks
228
Merge medio
15 h 48 min
PR fusionados (30 d)
62

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-hawkbit/hawkbit

Todos los issues de eclipse-hawkbit/hawkbit

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.