[SERVER-68854] Fix deadlock in SchedulingTicketHolder Created: 16/Aug/22  Updated: 29/Oct/23  Resolved: 29/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.1, 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jordi Olivares Provencio Assignee: Jordi Olivares Provencio
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Related
related to SERVER-69178 Interruptible::waitForConditionOrInte... Open
related to SERVER-69179 Replace custom waking in SchedulingTi... Blocked
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.1
Sprint: Execution Team 2022-08-22, Execution Team 2022-09-05
Participants:
Linked BF Score: 160

 Description   

It seems that during execution of the benchmarks for ticketholders sometimes the SchedulingTicketHolder deadlocks.

 

Thread 195: "ticketholder_bm" (Thread 0x7fdcd96d7700 (LWP 5353))
Duplicate Thread 187: "ticketholder_bm" (Thread 0x7fdcdd6df700 (LWP 5345))
Duplicate Thread 186: "ticketholder_bm" (Thread 0x7fdcddee0700 (LWP 5344))
Duplicate Thread 173: "ticketholder_bm" (Thread 0x7fdce46ed700 (LWP 5331))
#0  0x00007fdd3857e48c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00005594a6514ddc in std::condition_variable::wait(std::unique_lock<std::mutex>&) ()
#2  0x00005594a6155cbc in mongo::Interruptible::waitForConditionOrInterruptUntil<std::unique_lock<std::shared_mutex>, mongo::SchedulingTicketHolder::Queue::enqueue(mongo::Interruptible*, std::unique_lock<std::shared_mutex>&, mongo::Date_t const&)::{lambda()#2}>(mongo::stdx::condition_variable&, std::unique_lock<std::shared_mutex>&, mongo::Date_t, mongo::SchedulingTicketHolder::Queue::enqueue(mongo::Interruptible*, std::unique_lock<std::shared_mutex>&, mongo::Date_t const&)::{lambda()#2})::{lambda(mongo::Date_t, mongo::Interruptible::WakeSpeed)#3}::operator() ()
#3  0x00005594a61577e9 in mongo::SchedulingTicketHolder::Queue::enqueue(mongo::Interruptible*, std::unique_lock<std::shared_mutex>&, mongo::Date_t const&) ()
#4  0x00005594a6157ac1 in mongo::SchedulingTicketHolder::_waitForTicketUntilImpl(mongo::OperationContext*, mongo::AdmissionContext*, mongo::Date_t, mongo::TicketHolder::WaitMode) ()
#5  0x00005594a6154998 in mongo::TicketHolderWithQueueingStats::waitForTicketUntil(mongo::OperationContext*, mongo::AdmissionContext*, mongo::Date_t, mongo::TicketHolder::WaitMode) ()
#6  0x00005594a61548a2 in mongo::TicketHolderWithQueueingStats::waitForTicket(mongo::OperationContext*, mongo::AdmissionContext*, mongo::TicketHolder::WaitMode) ()
#7  0x00005594a614c4b2 in void mongo::(anonymous namespace)::BM_acquireAndRelease<mongo::StochasticTicketHolder>(benchmark::State&) ()
#8  0x00005594a62b42a0 in benchmark::internal::BenchmarkInstance::Run(unsigned long, int, benchmark::internal::ThreadTimer*, benchmark::internal::ThreadManager*) const ()
#9  0x00005594a62ced57 in benchmark::internal::(anonymous namespace)::RunInThread(benchmark::internal::BenchmarkInstance const*, unsigned long, int, benchmark::internal::ThreadManager*) ()
#10 0x00005594a6517c1f in execute_native_thread_routine ()
#11 0x00007fdd385782de in start_thread () from /lib64/libpthread.so.0
#12 0x00007fdd382a8a63 in clone () from /lib64/libc.so.6



 Comments   
Comment by Githook User [ 05/Oct/22 ]

Author:

{'name': 'Jordi Olivares Provencio', 'email': 'jordi.olivares-provencio@mongodb.com', 'username': 'jordiolivares'}

Message: SERVER-68854 Refactor SchedulingTicketHolder queueing logic
Branch: v6.1
https://github.com/mongodb/mongo/commit/acab83f1479eaea3b75fe03f2ed9f92f980e6f3a

Comment by Githook User [ 26/Aug/22 ]

Author:

{'name': 'Jordi Olivares Provencio', 'email': 'jordi.olivares-provencio@mongodb.com', 'username': 'jordiolivares'}

Message: SERVER-68854 Refactor SchedulingTicketHolder queueing logic
Branch: master
https://github.com/mongodb/mongo/commit/1bb3510dbff6981839aca538ee0cf1d230878a9c

Comment by Githook User [ 25/Aug/22 ]

Author:

{'name': 'Sviatlana Zuiko', 'email': 'sviatlana.zuiko@mongodb.com', 'username': 'szuiko'}

Message: Revert "SERVER-68854 Refactor SchedulingTicketHolder queueing logic"

This reverts commit b887165489cd44f581946b341a8941d2d27ddfec.
Branch: master
https://github.com/mongodb/mongo/commit/d3b68ac11a3283f4afd9ce4c2e519b180caa9879

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