attic icon indicating copy to clipboard operation
attic copied to clipboard

Duplicate key error while pushing to cache

Open diogotcorreia opened this issue 1 month ago • 0 comments

This happened when pushing to my attic cache from CI. Since multiple machines are being built at the same time, it is possible that more than one client is pushing to the cache, so this might be a race condition somewhere.

May 08 04:07:40 atticd[1109]: Attic Server 0.1.0 (release)
May 08 04:07:40 atticd[1109]: Running migrations...
May 08 04:07:40 atticd[1109]: Starting API server...
May 08 04:07:40 atticd[1109]: Listening on [::]:8004...
May 11 12:27:04 atticd[1109]: 2024-05-11T11:27:04.604136Z ERROR attic_server::error: Database error: Query Error: error returned from database: duplicate key value violates unique constraint "idx-object-cache-hash"
May 11 12:27:04 atticd[1109]:    0: attic_server::api::v1::upload_path::upload_path
May 11 12:27:04 atticd[1109]:              at server/src/api/v1/upload_path.rs:117
May 11 12:27:04 atticd[1109]:    1: tower_http::trace::make_span::request
May 11 12:27:04 atticd[1109]:            with method=PUT uri=/_api/v1/upload-path version=HTTP/1.1
May 11 12:27:04 atticd[1109]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tower-http-0.4.4/src/trace/make_span.rs:109
May 11 12:27:04 atticd[1109]:    2: tokio::task::runtime.spawn
May 11 12:27:04 atticd[1109]:            with kind=task task.name= task.id=7642488 loc.file="/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/hyper-0.14.27/src/common/exec.rs" loc.line=49 loc.col=21
May 11 12:27:04 atticd[1109]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tokio-1.34.0/src/util/trace.rs:17
May 11 12:27:04 atticd[1109]: 2024-05-11T11:27:04.651515Z ERROR tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=16210 ms

From client log:

❌ 29dik9ai6w9ss52zqsz8d756brg7ndvq-hwdb.bin: InternalServerError: The server encountered an internal error or misconfiguration.
// ...
 Error: InternalServerError: The server encountered an internal error or misconfiguration.
Error: Process completed with exit code 1.

Attic version (server and client): 4dbdbee45728d8ce5788db6461aaaa89d98081f0 Push command arguments: -j 2 CI logs (might not be available for that long): https://github.com/diogotcorreia/dotfiles/actions/runs/9043154351/job/24850756629

diogotcorreia avatar May 11 '24 11:05 diogotcorreia