Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61860

Death Test should exec after fork

    • Fully Compatible
    • ALL
    • Service Arch 2022-03-07, Service Arch 2022-03-21, Service Arch 2022-04-04
    • 170
    • 4

      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).

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: