[SERVER-13729] Reads & Writes are blocked during data file allocation on Windows Created: 24/Apr/14  Updated: 11/Mar/15  Resolved: 06/Jun/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 2.6.4, 2.7.2

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: Windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-9868 heartbeats not responded to during mm... Closed
is depended on by SERVER-12880 Server pauses on requests every 60 se... Closed
is depended on by SERVER-13444 Long locked flush without inserts and... Closed
Related
is related to SERVER-14198 Std::set<pointer> and Windows Heap Al... Closed
Tested
Backwards Compatibility: Fully Compatible
Operating System: Windows
Backport Completed:
Sprint: Server 2.7.2
Participants:

 Description   
Issue Status as of Jul 18, 2014

ISSUE SUMMARY
On Windows, all reads and writes are blocked during data file allocation due to unecessary locking.

USER IMPACT
mongod stops processing all requests until I/O is completed. This has a negative performance impact, and if the blocking is too long it can impact heartbeats on replica sets.

WORKAROUNDS
N/A

AFFECTED VERSIONS
MongoDB production releases up to 2.6.3 are affected by this issue.

FIX VERSION
The fix is included in the 2.6.4 production release.

RESOLUTION DETAILS
Add a dedicated lock to handle the case of the race condition between _flushAll and the file being closed.

Original description

T1: Generic Query Thread: Holds: Nothing, Acquires DBLock(R), Waits on T2
T2: AllocateFile Thread: Holds DBLock(W), Acquires: LockMongoFilesExclusive, Waits T3
T3: Flush: Holds LockMongoFilesShared, Waits: I/O

Problem: The MemoryMappedFile class needs to support concurrency, but was not correctly implemented so the wrong lock was used which causes unneeded synchronization.
Fix: Add a dedicated lock to handle the case of the race condition between _flushAll, and the file being closed.
Introduced in the fix for SERVER-7973



 Comments   
Comment by Githook User [ 16/Jun/14 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-13729: Fix Data File Growth on Windows

Reuse an existing lock to use as a lock to handle the race condition
between _flushAll, and the memory mapped file being closed instead
of holding LockMongoFilesxxx for an excessively long time.

(cherry picked from commit c4fa4dc85aec3b8dfd9ada7a58521d8f1bbf4fff)
Branch: v2.6
https://github.com/mongodb/mongo/commit/c98867bc6805da23c35c5c827c96f27a6a349006

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-13729: Fix Data File Growth on Windows

Reuse an existing lock to use as a lock to handle the race condition
between _flushAll, and the memory mapped file being closed instead
of holding LockMongoFilesxxx for an excessively long time.
Branch: master
https://github.com/mongodb/mongo/commit/c4fa4dc85aec3b8dfd9ada7a58521d8f1bbf4fff

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