oxidecomputer / oxidecomputer/buildomat

upload error: UNIQUE constraint failed: job_output.job, job_output.path

Open
#50 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
72
Forks
5
PR merge metrics
No merged PRs in 30d

Description

We have had a job that should have succeeded fail with what really feels like a spurious error:

169	2024-03-02T01:12:08.179Z	uploading: /tmp/debug/mpstat.txt (287893 bytes)
170	2024-03-02T01:12:08.210Z	upload warning: file "/tmp/debug/mpstat.txt" changed size mid upload: 287893 -> 290801
171	2024-03-02T01:12:11.291Z	upload error: UNIQUE constraint failed: job_output.job, job_output.path (after 50ms)

https://buildomat.eng.oxide.computer/wg/0/details/01HQYA1M8P0PTRSDTX7D29TQG7/HMHmaiTYYh2ZNSaXhABC0NuQTxIOlgzMpSb2gAL7QY92DMdg/01HQYA20KPJWHJS6FEX70D82K5#S171

I suspect this is the result of a file upload that was interrupted after (partially) succeeding while the buildomat API server was being redeployed:

$ LANG=C egrep '^\[|01HQYBFSD4QS3E6ZGD6BD02BFN' /var/tmp/20240302T01.log | looker
01:12:08.212Z INFO buildomat (files): starting work on job 01HQYA2ARPXZ0BKACQTXJ40TJJ commit 01HQYBFSD4QS3E6ZGD6BD02BFN
    chunks = 2
    expected_size = 290801
    file-commit = 0
    queue_depth = 0
01:12:08.216Z INFO buildomat (files): finished work on job 01HQYA2ARPXZ0BKACQTXJ40TJJ commit 01HQYBFSD4QS3E6ZGD6BD02BFN
    duration_msec = 3
    file-commit = 0
[ Mar  2 01:12:09 Stopping because service restarting. ]
[ Mar  2 01:12:09 Executing stop method (:kill). ]
[ Mar  2 01:12:09 Executing start method ("/opt/buildomat/lib/buildomat-server -b 0.0.0.0:9979 -f config.toml &"). ]
[ Mar  2 01:12:09 Method "start" exited with status 0. ]
01:12:10.278Z INFO buildomat (files): starting work on job 01HQYA2ARPXZ0BKACQTXJ40TJJ commit 01HQYBFSD4QS3E6ZGD6BD02BFN
    chunks = 2
    expected_size = 290801
    file-commit = 0
    queue_depth = 0
01:12:10.328Z ERRO buildomat (files): job 01HQYA2ARPXZ0BKACQTXJ40TJJ commit 01HQYBFSD4QS3E6ZGD6BD02BFN failed: database: UNIQUE constraint failed: job_output.job, job_output.path
    duration_msec = 50
    file-commit = 0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the buildomat API server's file-upload path and the database write represented by the job_output.job, job_output.path constraint. Reproduce or inspect the redeployment interruption scenario, then verify that a partially completed upload can be retried without a UNIQUE constraint failure and that the job completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.