[SERVER-44746] Fix LatchAnalyzerTest Created: 20/Nov/19  Updated: 29/Oct/23  Resolved: 02/Dec/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3.3

Type: Improvement Priority: Major - P3
Reporter: Benjamin Caimano (Inactive) Assignee: Rahul Sundararaman (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2019-12-02, Service Arch 2019-12-16
Participants:
Linked BF Score: 0

 Description   

It seems that Windows doesn't allow us to dtor a locked mutex (that behavior is in fact UB). This implies that failures during lock could be hidden by consequential failures during unlock. We should:

  • invariant that Mutex is unlocked on dtor via a boolean flag
  • allow turning on and off the latch analyzer
  • alter the test to have a stack of lock and unlock events

As an example for LatchAnalyzerTest::AddValidWasAbsent, we would:

l2.acquire();
l1.acquire();
{
    LatchAnalyzerDisabledBlock block;
    l1.release();
    l2.release();
}



 Comments   
Comment by Githook User [ 03/Mar/20 ]

Author:

{'name': 'Ben Caimano', 'email': 'ben.caimano@10gen.com'}

Message: SERVER-43945 Expose out of order latch acquisitions in serverStatus

This commit also backports:

SERVER-42897 Validate base-level latches
SERVER-44746 Fix LatchAnalyzerTest
SERVER-44155 Validate a subset of latches of all levels
SERVER-45691 Change Mutex::LockListeners to use a std::vector again
SERVER-45793 Improve mongo::Mutex contract
SERVER-45424 Track local latch::Identities when getTestCommandsEnabled()
SERVER-46041 Add DiagnosticListener/WaitListener LSAN suppressions
SERVER-46461 Make static in getDiagnosticListenerState() immortal to fix destruction order issues during shutdown
SERVER-46197 Make build flag to disable diagnostic latches
SERVER-45276 Release lock before destroying DBClientBases
Branch: v4.2
https://github.com/mongodb/mongo/commit/24b6ee2dd48e3f1cfde1c4d7e2b01bd73921fbad

Comment by Githook User [ 02/Dec/19 ]

Author:

{'email': 'rahul.sundararaman@mongodb.com', 'name': 'Rahul Sundararaman'}

Message: SERVER-44746 Fix LatchAnalyzerTest
Branch: master
https://github.com/mongodb/mongo/commit/cb125fa6284810a767a6e2ec50f940eb1eca7fad

Comment by Githook User [ 20/Nov/19 ]

Author:

{'name': 'Ben Caimano', 'username': 'bcaimano', 'email': 'ben.caimano@mongodb.com'}

Message: SERVER-44746 Temporarily disable latch_analyzer_test.cpp
Branch: master
https://github.com/mongodb/mongo/commit/ddf887d75b1e85762258f0e4953d2bc13562c889

Generated at Thu Feb 08 05:06:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.