ES /docs

ActiveRecord::LockWaitTimeout: Mysql2::Error::TimeoutError: Lock wait timeout exceeded; try restarting transaction

Service
cupixworks-api
Occurrences
395
Status
Reported
Confidence
85%
Actionability
52%
Cluster ID
319c22bc-32c0-4335-914d-30cc90ed4331
First Seen
2024-08-16 03:53 UTC
Last Seen
2026-08-04 19:57 UTC
Actions

ActiveRecord::LockWaitTimeout: Mysql2::Error::TimeoutError: Lock wait timeout exceeded; try restarting transaction

What Happened#

cupixworks-api (tesla) 에서 InnoDB row-lock 대기 시간 초과(Mysql2::Error::TimeoutError: Lock wait timeout exceeded)가 여러 write 엔드포인트에 걸쳐 산발적으로 발생했다. 이 Error Tracking issue 는 특정 코드 경로 하나가 아니라, 동시 쓰기 부하 상황에서 같은 행/인접 행을 두고 트랜잭션이 서로의 잠금을 기다리다 InnoDB innodb_lock_wait_timeout(기본 50s) 을 넘긴 케이스들을 하나로 묶은 것이다. tesla 는 이미 이 예외를 controller 레벨에서 rescue_from 하여 재시도 가능한 502 BadGateway 로 변환하고 있어, 미처리 크래시나 nil 참조 같은 코드 결함이 아니다.

Quick Facts#

Field Value
exception.class ActiveRecord::LockWaitTimeout
exception.message Mysql2::Error::TimeoutError: Lock wait timeout exceeded; try restarting transaction
top_frame 코드 경로 다수 — 단일 프레임 아님 (엔드포인트별 상이)
runtime Rails (tesla), MySQL / InnoDB
env production, cupixworks-api

Affected Teams#

Datadog 최근 14일 로그(100건 표본) 상 여러 엔드포인트에 분산되어 특정 도메인에 집중되지 않는다.

Team / Domain Error Count (14d 표본) Impact
ElementTraces (#bulk) 17 bulk 편집 저장이 간헐적으로 502 → 클라이언트 재시도
Panos (#update, #check_*, #update_meta_by_key) 18 pano 업데이트/업로드 확인 간헐 502
Jobs (#update) 7 job 상태 갱신 간헐 502
Captures (#update, #process_output_upload_url) 4 capture 갱신 간헐 502
Levels / Assets / Editings 등 4 기타 write 간헐 502

Timeline#

  1. 2024-08-16 12:53 KST — Error Tracking issue 최초 감지 (first_seen, 대표 샘플은 이 시점 기준으로 stale)
  2. 2026-08-03 17:43~17:46 KSTElementTracesController#bulk 에서 연속 502 burst
  3. 2026-08-04 13:06~13:08 KSTPanosController#update / check_tile_uploading / check_mask_uploading 동일 pano ID 대상 burst
  4. 2026-08-04 13:40~13:46 KSTElementTracesController#bulk 재발 (last_seen)

Scoring#

Confidence 85% · Actionability 52%

Confidence#

Dimension Score Detail
Evidence completeness 5/5 13 code refs, 3 log queries
Code path explicitness 3/3 13 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 5/5 trivial
Affected files 1/5 14 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