holdStock is check-then-act; two last-unit holds can both succeed
- 分类
- concurrency
- ID
fr-20260921-002- 位置
src/inventory.js:49- 置信度
- 87%
证据
readStock to available then putStock with no lock. Two concurrent quantity=1 holds when available=1 both pass the check.
修复建议
Make the availability check and reserved increment one atomic update under withLock.