[SERVER-61860] Death Test should exec after fork Created: 02/Dec/21  Updated: 29/Oct/23  Resolved: 20/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: George Wangensteen Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: auto-reverted, servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
causes SERVER-70705 Death Test invoked via PATH fails to ... Closed
Related
related to SERVER-70604 decrease fork-exec window in jstest s... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-03-07, Service Arch 2022-03-21, Service Arch 2022-04-04
Participants:
Linked BF Score: 170
Story Points: 4

 Description   

Currently, death test unittests work by having a the main unittest process fork(), and then running the code that's expected to crash in the child process. This requires the parent process to be very careful to ensure that all of the state shared with the child process at the time of fork() (i.e. the entire address space which is copied) is in a  consistent state. In the case of third-party libraries we vendor (like gperftools), this often means relying on things like pthread_atfork registered handlers to ensure locks are in a consistent state; this can be fragile (the order pthread_atfork handlers will run in is hard to determine, see https://github.com/gperftools/gperftools/issues/904). 

 

Since the child doesn't actually need to share any state with the parent, we should give it a "fresh start" and have it run the code expected to crash in a clean process image via exec(); the parent can still listen in on that process to ensure it fails as expected. This will prevent the child process from starting with bad state (for example locks held in the allocator).



 Comments   
Comment by Githook User [ 20/Mar/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-61860 exec in most DEATH_TESTs
Branch: master
https://github.com/mongodb/mongo/commit/f0f9428b2f1cf7526807dc3f49fdada4ef98d30d

Comment by xgen-buildbaron-user [ 17/Mar/22 ]

Ticket re-opened due to revert. stitch_support_install_tests began a consistent failure of stitch_support_install_tests

Comment by Githook User [ 17/Mar/22 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com'}

Message: Revert "SERVER-61860 exec in most DEATH_TESTs"

This reverts commit b372b25622b9ec4dd7ae5b8e3424218b8eaa774a.
Branch: master
https://github.com/mongodb/mongo/commit/3ec4631a7f16b76f7490ec8b68fc778c8c7416c3

Comment by Githook User [ 16/Mar/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-61860 exec in most DEATH_TESTs
Branch: master
https://github.com/mongodb/mongo/commit/b372b25622b9ec4dd7ae5b8e3424218b8eaa774a

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