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

segmentation violation when calling gROOT->ProcessLine()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.04/18, 6.06/08
    • Fix Version/s: 6.10/00
    • Component/s: Cling, Core Libraries
    • Labels:
      None
    • Environment:

      Description

      When calling gROOT->ProcessLine();, occasionally a segmentation violation occurs. This does not happen always (>50% chance) and also depends on how much other code is around. I condensed it to this minimal version, in which it still occurs:

      i_crash.cpp

      /* compile with
       *   g++ -o i_crash i_crash.cpp `root-config --cflags --glibs`
       */
       
      #include <iostream>
      #include <memory>
      #include <vector>
       
      #include "TApplication.h"
       
      #include "TROOT.h"
      #include "TStyle.h"
       
      int main(int argc, char* argv[])
      {
         std::vector<std::string> vCommands;
         std::string optNoStats = "-ns";
         std::string optCommand = "-c";
         for (int i=1; i<argc;i++){
            if (optNoStats.compare(argv[i]) == 0){
               gStyle->SetOptStat(0);
               continue;
            }
       
            if (optCommand.compare(argv[i]) == 0) {
               vCommands.push_back(argv[++i]);
               continue;
            }
         }
       
         for (std::string cmd: vCommands) {
            gROOT->ProcessLine(cmd.c_str());
         }
       
         return 0;
      }


      If I remove the optNoStats parts, I do not get crashes (or did not try often enough), so this seems to be a race condition problem. I get very similar crashes when calling gROOT->Macro() instead of gROOT->ProcessLine().

      The stack trace for the above example:

      $ ./i_crash -c "gStyle->SetGridStyle(1)" 
       
       *** Break *** segmentation violation
       
       
       
      ===========================================================
      There was a crash.
      This is the entire stack trace of all threads:
      ===========================================================
      #0  0x00007f1391feba0c in __libc_waitpid (pid=13549, stat_loc=stat_loc
      entry=0x7ffe43b01c40, options=options
      entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
      #1  0x00007f1391f71232 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
      #2  0x00007f1392acaf43 in TUnixSystem::StackTrace (this=0x125e8e0) at /home/jolange/compile/root/core/unix/src/TUnixSystem.cxx:2324
      #3  0x00007f1392acd94c in TUnixSystem::DispatchSignals (this=0x125e8e0, sig=kSigSegmentationViolation) at /home/jolange/compile/root/core/unix/src/TUnixSystem.cxx:3562
      #4  <signal handler called>
      #5  0x00007f1392ff5090 in ?? ()
      #6  0x00007ffe43b04210 in ?? ()
      #7  0x00007f1392ff5054 in ?? ()
      #8  0x00000000019278c8 in ?? ()
      #9  0x00007ffe43b044f0 in ?? ()
      #10 0x00007ffe43b04280 in ?? ()
      #11 0x00007f138ea07b43 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /home/jolange/local/root_v6-06-08/lib/libCling.so
      #12 0x00007f138ea0d1a7 in cling::Interpreter::EvaluateInternal(std::string const&, cling::CompilationOptions, cling::Value*, cling::Transaction**) () from /home/jolange/local/root_v6-06-08/lib/libCling.so
      #13 0x00007f138ea0d2e3 in cling::Interpreter::process(std::string const&, cling::Value*, cling::Transaction**) () from /home/jolange/local/root_v6-06-08/lib/libCling.so
      #14 0x00007f138eaa54d3 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/jolange/local/root_v6-06-08/lib/libCling.so
      #15 0x00007f138e9a166d in TCling::ProcessLine (this=0x12bd160, line=<optimized out>, error=0x0) at /home/jolange/compile/root/core/meta/src/TCling.cxx:2001
      #16 0x00007f1392a33770 in TApplication::ProcessLine (this=0x1ac2b10, line=<optimized out>, sync=<optimized out>, err=0x0) at /home/jolange/compile/root/core/base/src/TApplication.cxx:997
      #17 0x00007f1392957d71 in TROOT::ProcessLine (this=0x7f1392da5880 <ROOT::Internal::GetROOT1()::alloc>, line=<optimized out>, error=0x0) at /home/jolange/compile/root/core/base/src/TROOT.cxx:2025
      #18 0x0000000000403382 in main ()
      ===========================================================

      Might be related to ROOT-8109.

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            jolange Johannes Lange (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: