[SERVER-75511] FLE2 unsharded compaction may deadlock if a setFCV occurs concurrently Created: 30/Mar/23  Updated: 29/Oct/23  Resolved: 06/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2023-04-03, Security 2023-04-17
Participants:

 Description   

If a setFCV command is issued while a FLE 2 compaction (unsharded) operation has transactions running, the FCV op observer will abort those transactions, and cause them to be retried. The FCV command then waits until it can acquire the FCV lock in S mode. At this point the FCV command is blocked, because the compact command is still holding onto a DBLock (and the global lock) in IX mode here.

Meanwhile, the The retry transaction step will issue a "best effort abort" on the cancelled transaction, which entails issuing an abortTransaction command (see here). The invocation of this command ultimately tries to acquire the global lock on IX mode as well, so it also blocks. This lock acquisition happens here.



 Comments   
Comment by Githook User [ 06/Apr/23 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-75511 Block setFCV while performing unsharded compaction
Branch: master
https://github.com/mongodb/mongo/commit/210d64dc0fb5bccff00495849855cf9d5d37e9d3

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