mongodb
resource_error
ai_generated
true
MongoServerError: mmapv1 锁获取超时
MongoServerError: mmapv1 lock acquire timeout
ID: mongodb/mmapv1-lock-acquire-timeout
90%修复率
85%置信度
1证据数
2023-03-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| mongodb-3.2 | active | — | — | — |
| mongodb-3.4 | active | — | — | — |
| mongodb-3.6 | active | — | — | — |
根因分析
使用已弃用的 MMAPv1 存储引擎时,由于高并发,写入操作等待数据库级锁超时。
English
With the deprecated MMAPv1 storage engine, a write operation waited too long for a database-level lock due to high concurrency.
官方文档
https://www.mongodb.com/docs/v3.6/faq/storage/#does-mmapv1-have-locking-issues解决方案
-
Migrate to WiredTiger storage engine which uses document-level concurrency.
-
Reduce write concurrency by batching writes or using a queue to serialize operations.
无效尝试
常见但无效的做法:
-
80% 失败
Increasing lock timeout just delays failure; the underlying contention remains.
-
95% 失败
Adding more application threads exacerbates lock contention.