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

Spurious segfaults on creation of TRint instance if rootlogon uses <iostream>

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.06/00
    • Fix Version/s: 6.10/00
    • Component/s: None
    • Labels:
      None
    • Environment:

      Gentoo Linux x86_64, OpenSUSE 13.1 x86_64

    • Development:

      Description

      Dear ROOTers,

      some of our users encountered spurious startup-crashes of several ROOT-based applications after moving to ROOT 6 (ROOT 5 does not show this bug).

      This is with 'heads/master@v6-05-02-131-g5abce92' but probably holds for many other ROOT 6 versions.

      When using iostream and std::cout in rootlogon, programs invoking a TRint crash spuriously, probably related to a static initialization issue (which valgrind does not seem to see).

      Consider the following minimum example (all attached in a .tar.gz for convenience):

      ~/.rootrc

      Rint.Logon: ~/rootlogon.C

      ~/rootlogon.C

      {
              std::cout << "Root Logon - Success" << std::endl;
      }

      segInit.cpp

      #include <TRint.h>
      #include <iostream>
       
      int main(int argc, char** argv) {
              std::cout << "Before TRint..." << std::endl;
              TRint app("app", &argc, argv, 0, 0, kTRUE);
              std::cout << "After TRint..." << std::endl;
              return 0;
      }

      Shell

      $ g++ segInit.cpp -o segInit `root-config --cflags --libs`
      $ while ./segInit -b; do true; done
      Before TRint...
      Root Logon - Success
      After TRint...
      Before TRint...
      Root Logon - Success
      After TRint...
      Before TRint...
      Root Logon - Success
      After TRint...
      Before TRint...
      Root Logon - Success
      After TRint...
      Before TRint...
       
       *** Break *** segmentation violation

      The "-b" is just to make startup faster, the bug can also be triggered without that - all that's needed is some cout-usage in rootlogon and in the program before TRint is instantiated.
      The stacktrace ends (inside the ".x rootlogon.C" transaction) with:

      #6  0x000000345c099929 in std::ostream::sentry::sentry(std::ostream&) () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6

      There are sadly some "??" in the trace, seemingly since the JITted code does not have debug symbols (can one activate that?).

      I reproduced on both OpenSUSE 13.1 and current Gentoo Linux (completely different setups: One with cmake, the other with ./configure).

      If you can't reproduce, I can try to provide more information.

      The attached .tar.gz contains the .rootrc, the rootlogon.C, the example code and a very simple makefile.

      Cheers,
      Oliver

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            ofreyerm Oliver Freyermuth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: