|
The repro deadlocks in the following way:
- Statement 1 takes a lock on db.system.views in MODE_X.
- Statement 2 parses the $where, which causes a find to be run on db.system.js. Since there is no collection called db.system.js, we check if it is a view, which takes a mutex on the ViewCatalog.
- Statement 1 parses the $where, which causes a find to be run on db.system.js. It waits for the mutex on the ViewCatalog.
- Statement 2 attempts to iterate the DurableViewCatalog. It waits for a MODE_IS lock on db.system.views.
The deadlock was introduced in this commit, which changed DBClientCursor to use read commands by default, instead of OP_QUERY. When using OP_QUERY, if a collection does not exist, we do not check whether it is a view.
|