[SERVER-48346] Fix lifetime issues for barriers captured by reference Created: 21/May/20  Updated: 29/Oct/23  Resolved: 02/Jun/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.2.8, 4.4.0-rc8, 4.7.0

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

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2
Sprint: Service arch 2020-06-01, Service arch 2020-06-15
Participants:
Linked BF Score: 0

 Description   

We have instances in unit-tests, where we create a barrier, create a lambda that captures the barrier by reference, and then move the lambda to be executed by a separate thread (e.g., this one). In some cases, the barrier can go out of scope and freed, while the other thread is yet to finish the execution of the lambda. This incidents could sporadically cause access violation failures in unit-tests.



 Comments   
Comment by Githook User [ 02/Jun/20 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-48346 Fix lifetime issues for barriers captured by reference

Extends the lifetime of barriers that are referenced by background
threads and their reference could outlive the barrier's owner.

(cherry picked from commit 3b7bc03a8f8b964769ff708674163b67ddd1a450)
Branch: v4.2
https://github.com/mongodb/mongo/commit/fe30303411c922fe45d7466dd951b4244d79c5b2

Comment by Githook User [ 02/Jun/20 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-48346 Fix lifetime issues for barriers captured by reference

Extends the lifetime of barriers that are referenced by background
threads and their reference could outlive the barrier's owner.

(cherry picked from commit 3b7bc03a8f8b964769ff708674163b67ddd1a450)
Branch: v4.4
https://github.com/mongodb/mongo/commit/f841e415fa8fb7b057c1973f6ff8fc0460de1f08

Comment by Githook User [ 02/Jun/20 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-48346 Fix lifetime issues for barriers captured by reference

Extends the lifetime of barriers that are referenced by background
threads and their reference could outlive the barrier's owner.
Branch: master
https://github.com/mongodb/mongo/commit/3b7bc03a8f8b964769ff708674163b67ddd1a450

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