Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8395

gROOT singleton pattern can cause seg faults at end of process

    XMLWordPrintable

    Details

      Description

      The singleton pattern that is used for gROOT ensures that one and only one instance of TROOT will ever be created during the lifetime of a process. Being a singleton, this seems sensible but it is semantically different than only one instance of TROOT can exist at any given time. The current semantics can cause seg faults at the end of a process if some code depends on gROOT after the gROOT has already destructed. This can happen when there a static global destructs after gROOT.

      I have attached CMakeLists.txt and test.cpp files that together create a test program, test1, that demonstrates the behavior on gcc 4.9. Build it as:

      cmake -DROOT_DIR=/path/to/root/cmake/config /path/to/source

      Segmentation faults when the process is shutting down are probably not the end of the world. However, they could cause problems with leaking resources other than memory, which is a big deal.

        Attachments

        1. CMakeLists.txt
          0.2 kB
        2. test.cpp
          0.2 kB

          Activity

            People

            Assignee:
            pcanal Philippe Canal
            Reporter:
            f19db89733b3abaecaf3 Jeromy Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: