[SERVER-63857] Synchronize background thread in SleepInterruption dbtest Created: 19/Feb/22  Updated: 29/Oct/23  Resolved: 24/Mar/22

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

Type: Bug Priority: Major - P3
Reporter: Justin Seyster Assignee: Justin Seyster
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
Operating System: ALL
Sprint: QE 2022-04-04, QE 2022-03-07, QE 2022-03-21
Participants:
Linked BF Score: 32

 Description   

The SleepInterrupt dbtest launches a background thread to run the Javascript interpreter and then accesses the background thread's Javascript Scope object to issue an interrupt. There is a potential for a use-after-free error if the background thread exits before the parent thread has the chance to issue the interrupt.

The long sleep in the background Javascript task should prevent this scenario, but some test failures seem to indicate that this use-after-free scenario is occurring nonetheless. It is possible that the sleep is somehow failing and returning immediately.

Synchronizing the background thread so that it waits until it's safe to destroy its Javascript Scope will hopefully prevent this crash and instead cause the test to fail with a more useful error.



 Comments   
Comment by Ethan Zhang (Inactive) [ 24/Mar/22 ]

Please note that this ticket fixes the use-after-free problem that was manifested in the linked BF so it won't crash. It is possible that the ever-sleeping background thread failed to sleep and caused it to exit prematurely. This fix will help us reveal the underlying issue if it happens again and it will be captured as a totally different BF.

Comment by Githook User [ 24/Mar/22 ]

Author:

{'name': 'Justin Seyster', 'email': 'justin.seyster@mongodb.com', 'username': 'jseyster'}

Message: SERVER-63857 Synchronize background thread in SleepInterruption dbtest
Branch: master
https://github.com/mongodb/mongo/commit/384829b6b0b88824a2657d50068bf446664c5cb4

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