Rails: Shadow Facets of Concurrency
summary
Shows concrete failure modes in Rails: simple model-level uniq validation allows races so the database can end up with 15 duplicate records under concurrent requests, because each process has its own DB connection and non-atomic checks race. Demonstrates fixes: add a unique index and use transactional locking or retry-on-constraint-error. Shows test that reproduces the bug, describes deployment workarounds (restart or drain during asset compilation) and whether each fix actually prevents duplicates.
AI-written summary · about
chapters (8)
- 0:00Start
- 0:18Building World Class Apps.
- 4:00RAILS_ENV=test
- 10:25unique.fix :db, diy: true, mysql: true
- 22:28deploy shutdown
- 26:39Development and Deployment
- 32:56Facets #6 - #N. Homewo
- 35:29Platinum Sponsor
related talks
29mPutting Rails in a corner: Understanding database isolation
32mRails Sustainable Productivity
26mDon't Rewrite Your Framework
01h 09mAll the Things I Thought I Couldn't Do
41mOff the Tracks - Challenging the Rails Mindset
41mAn Intervention for ActiveRecord
33mThe Very Hungry Transaction
40mTricks That Rails Didn't Tell You About
