EditingRepository#update — missing deadlock retry wrapper
Service
cupixworks-api
Occurrences
51
Status
Reported
Confidence
85%
Actionability
36%
Cluster ID
75870209-82b0-4c8e-938c-7604539b8be7
First Seen
2025-02-04 00:09 UTC
Last Seen
2026-08-04 06:43 UTC
Actions
EditingRepository#update — missing deadlock retry wrapper
What Happened#
cupixworks-api (tesla) 의 PATCH /api/v1/editings/{id} (Api::V1::EditingsController#update) 요청이 InnoDB deadlock 으로 실패하고 있다. Editing#save! 가 하나의 트랜잭션 안에서 state_machine transition callback 을 통해 자기 자신뿐 아니라 관련 row (parent editing, review editing, editing_entities, reviewer) 를 함께 갱신하는데, 여러 editor 가 동시에 editing 을 수정할 때 lock 획득 순서가 엇갈리면서 MySQL 이 deadlock victim 을 골라 트랜잭션을 강제 롤백한다. Rails 는 이를 ActiveRecord::Deadlocked 로 감싸 503 응답을 반환한다. 51건이 약 3개월에 걸쳐 발생했고, 대부분 같은 초 안에 서로 다른 editing ID 로 몰려서 나타나는 전형적인 동시성 lock 충돌 패턴이다.
Quick Facts#
| Field | Value |
|---|---|
| exception.class | ActiveRecord::Deadlocked (root: Mysql2::Error) |
| exception.message | Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction |
| top_frame | app/repositories/editing_repository.rb:17 (@model.save!) |
| endpoint | PATCH /api/v1/editings/{id} (Api::V1::EditingsController#update) |
| http_status | 503 |
| env | production (service: cupixworks-api) |
Affected Teams#
| Team / Domain | Error Count | Impact |
|---|---|---|
| cupixworks-api / Editing (편집 워크플로우) | 51 (3개월) | editor 의 editing 저장 요청이 간헐적으로 503 으로 실패, 재시도 필요 |
Timeline#
- 2026-04-24 00:18 KST — 최초 발생 (first_seen, Error Tracking issue 등록)
- 2026-08-01 00:05 KST — cluster 파일 기준 last_seen
- 2026-08-03 ~ 2026-08-04 — Datadog 로그에서 지속 재발 확인 (최근 14일 내 다수 발생, 아래 Log Evidence 참고)
- 2026-08-04 — RCA 수행
Scoring#
Confidence 85% · Actionability 36%
Confidence#
| Dimension | Score | Detail |
|---|---|---|
| Evidence completeness | 5/5 | 14 code refs, 3 log queries |
| Code path explicitness | 3/3 | 14 file:line refs |
| Log evidence | 3/3 | section, query, pattern |
| RCA structure | 3/3 | 3/3 sections |
| Revision history | 0/3 | 0 revision(s) |
| Agent execution | 3/3 | success |
Actionability#
| Dimension | Score | Detail |
|---|---|---|
| Fix complexity | 1/5 | critical |
| Affected files | 1/5 | 15 file(s) |
| Single repo | 1/3 | 2 service(s) |
| Immediate actions | 0/3 | absent |
| Testability | 0/3 | no test info |
| External dependency | 3/3 | no external deps |
| Data migration | 3/3 | no migration |