[SERVER-16591] Deadlock due to KVDatabaseCatalogEntry doing blocking transactional operations under the _collectionsLock Created: 18/Dec/14  Updated: 15/Jan/15  Resolved: 05/Jan/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 2.8.0-rc5

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Kaloian Manassiev
Resolution: Done Votes: 0
Labels: 28qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File stacks.txt    
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

See the attached stack dump file.

KVDatabaseCatalogEntry::sizeOnDisk is called under the KVDatabaseCatalogEntry::_collectionsLock in thread #16, but we are under a WT transaction there (i.e. snapshot is being held).

The code which already holds the _collectionsLock (threads #13 or #15) is stuck on eviction. Eviction cannot proceed because of the transaction started by thread #16, but thread #16 cannot make progress because it's stuck on the _collectionsLock.

The solution would be to not call WT methods under this mutex.

I believe the list of collections should be stable, because we are under the DB IX lock and adding a collection requires DB X lock, so we can completely get rid of this mutex.



 Comments   
Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-16591 Fix broken mmap suite use_power_of_2_a.js test
Branch: master
https://github.com/mongodb/mongo/commit/f1e1714f0e7973ed92af202abd1bfc7ddad31506

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-16591 Get rid of _collectionsLock in the database catalog

This lock is not needed anymore since any modifications to the set of
collections are done with the database X lock held.
Branch: master
https://github.com/mongodb/mongo/commit/12d82c741061da23a442086465322352f157d094

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-16591 Clean up MMAPV1DatabaseCatalogEntry initialization
Branch: master
https://github.com/mongodb/mongo/commit/a55a7b936ec2f4e935db4de4f4edb4696935a08d

Comment by Scott Hernandez (Inactive) [ 18/Dec/14 ]

As discussed should remove the mmapv1 _collectionsLock as well.

Generated at Thu Feb 08 03:41:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.