[SERVER-34508] Prevent race condition in Migration Destination Manager from swallowing an exception Created: 16/Apr/18  Updated: 29/Oct/23  Resolved: 18/Apr/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.4.14, 3.6.4, 3.7.3
Fix Version/s: 3.4.15, 3.6.5, 3.7.6, 4.0.0-rc0

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

Issue Links:
Backports
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.6, v3.4
Sprint: Sharding 2018-04-23
Participants:
Linked BF Score: 54

 Description   

A triggerable race condition exists in the Migration Destination Manager's use of the producer-consumer queue. Upon throwing from inside the insert batch function, both of these will happen:

  1. The inserter thread will kill the operation with the insert batch function's exception.
  2. The guard on the inserter thread will close the consumer end of the queue.

If the main thread is currently fetching another batch from remote, it will try to push the batch to the queue before checking for an operation context interrupt. The queue will throw back its own exception, `ProducerConsumerQueueEndClosed`. The queue's exception will be the exception returned to the client. This results in the wrong error code returned.

This can be fixed by adding another checkForInterrupt in between the fetch batch function and the push to the queue, in case this race condition is triggered.



 Comments   
Comment by Githook User [ 17/Apr/18 ]

Author:

{'name': 'Blake Oler', 'email': 'blake.oler@mongodb.com', 'username': 'BlakeIsBlake'}

Message: SERVER-34508 Prevent race condition in Migration Destination Manager from swallowing an exception

(cherry-picked from commit a8d13f8329478996e315f390089039f7b7a29ab8)
Branch: v3.6
https://github.com/mongodb/mongo/commit/eef95e921c97c8809bccf439e179a7df5e0859d4

Comment by Githook User [ 17/Apr/18 ]

Author:

{'name': 'Blake Oler', 'email': 'blake.oler@mongodb.com', 'username': 'BlakeIsBlake'}

Message: SERVER-34508 Prevent race condition in Migration Destination Manager from swallowing an exception

(cherry-picked from commit a8d13f8329478996e315f390089039f7b7a29ab8)
Branch: v3.4
https://github.com/mongodb/mongo/commit/694b8966c8e24c20a6a11b35c0ebdb79b699b778

Comment by Githook User [ 17/Apr/18 ]

Author:

{'name': 'Blake Oler', 'email': 'blake.oler@mongodb.com', 'username': 'BlakeIsBlake'}

Message: SERVER-34508 Prevent race condition in Migration Destination Manager from swallowing an exception
Branch: master
https://github.com/mongodb/mongo/commit/a8d13f8329478996e315f390089039f7b7a29ab8

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