For IndexBuilder::_build to clean up failed background index builds, the database has to be locked in specific modes. If the index build was interrupted (for example due to a killOp), the calls to DBLock::relockWithMode(mode) calls will not succeed, leading to an invariant in the MultiIndexBlockImpl destructor.
This issue can be addressed by wrapping DBLock:relockWithMode() calls with an UninterruptibleLockGuard.