Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiled program with libNew.so crash #11353

Closed
gabigong opened this issue Sep 13, 2022 · 2 comments
Closed

Compiled program with libNew.so crash #11353

gabigong opened this issue Sep 13, 2022 · 2 comments

Comments

@gabigong
Copy link

gabigong commented Sep 13, 2022

Description of the bug

In order to use TMapFile I link the application with "-lNew"
For example if test.cpp is the root program to compile I will use

g++  -o test  test.cpp `root-config --new --cflags --glibs`

The program work without any issue with rootn.exe.
Using the compiled program, Immediately it breaks:

*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f9ece411e8a in waitpid () from /lib64/libc.so.6
#1  0x00007f9ece38d757 in do_system () from /lib64/libc.so.6
#2  0x00007f9ed00a44f5 in TUnixSystem::StackTrace() () from /home/root-6.26.04/builddir/lib/libCore.so
#3  0x00007f9ed00a1cc5 in TUnixSystem::DispatchSignals(ESignals) () from /home/root-6.26.04/builddir/lib/libCore.so
#4  <signal handler called>
#5  0x00007f9ec9b38d5b in TClingCallFunc::SetArg(long) () from /home/root-6.26.04/builddir/lib/libCling.so
#6  0x00007f9ecff6d683 in TApplication::LoadGraphicsLibs() () from /home/root-6.26.04/builddir/lib/libCore.so
#7  0x00007f9ecff6ca2a in TApplication::InitializeGraphics() () from /home/root-6.26.04/builddir/lib/libCore.so
#8  0x00007f9ecff70d89 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/root-6.26.04/builddir/lib/libCore.so
#9  0x00000000004011fc in main ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007f9ec9b38d5b in TClingCallFunc::SetArg(long) () from /home/root-6.26.04/builddir/lib/libCling.so
#6  0x00007f9ecff6d683 in TApplication::LoadGraphicsLibs() () from /home/root-6.26.04/builddir/lib/libCore.so
#7  0x00007f9ecff6ca2a in TApplication::InitializeGraphics() () from /home/root-6.26.04/builddir/lib/libCore.so
#8  0x00007f9ecff70d89 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/root-6.26.04/builddir/lib/libCore.so
#9  0x00000000004011fc in main ()
===========================================================

Expected behavior

The output messages should be:

Memory mapped file:   hsimple.map
Title:                Memory Mapped Hist
Option:               CREATE
Mapped Memory region: 0xb46a5000 - 0xb46be000 (0.10 MB)
Current breakval:     0xb46b0000
Object               Class                Size      
hpx                  TH1F                 1024

To Reproduce:

The source code test.cpp I am using follows:

// test.cpp
#include "TROOT.h"
#include "TApplication.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TMapFile.h"
#include "TRandom.h"

void hprod();

#ifndef __CINT__ 
 int main(int argc, char **argv)
 {
   TApplication* theApp = new TApplication("Shared Mem - Producer", &argc, argv);
   hprod();
   theApp->Run();
 }
#endif 

void hprod()
{
 TH1F *hpx;
 TH2F *hpxpy;
 TProfile *hprof;
 TMapFile::SetMapAddress(0xb46a5000);
 TMapFile *mfile = TMapFile::Create("hsimple.map","RECREATE", 100000,"Memory Mapped Hist");
 hpx = new TH1F("hpx","This is the px distribution",100,-4,4);
 
 // Print status of mapped file
 mfile->Print();
 
 // Endless loop filling histograms with random numbers
 Float_t px, py, pz;
 int ii = 0;
 while(1)
   {
     gRandom->Rannor(px,py);
     pz = px*px + py*py;
     hpx->Fill(px);
     if (!(ii % 10))
       { 
	 mfile->Update();
	 if (!ii) mfile->ls(); // print contents of mapped file after }
	 ii++;
       }
   }
}

To run mu code: ./test

My setup

  1. ROOT version: ROOT 6.26/04
  2. Operating system: Fedora 31
  3. How you obtained ROOT: I built it myself.
@gabigong gabigong added the bug label Sep 13, 2022
@ferdymercury
Copy link
Collaborator

ferdymercury commented Sep 14, 2022

Can you try with a more recent ROOT version? I do not get a crash there.

The problem however persists, even if linking with lNew, it raises an error:

Error in <TMapFile::TMapFile>: no memory mapped file capability available
Use rootn.exe or link application against "-lNew"
Memory mapped file:   hsimple.map
Title:                Memory Mapped Hist
Option:               file closed

@pcanal
Copy link
Member

pcanal commented Apr 25, 2024

This fixed in v6.32.00 and v6.34.00 (master).

@pcanal pcanal closed this as completed Apr 25, 2024
@pcanal pcanal added this to the 6.34/00 milestone Apr 25, 2024
@pcanal pcanal added this to Issues in Fixed in 6.32.00 via automation Apr 25, 2024
@pcanal pcanal added this to Issues in Fixed in 6.34.00 via automation Apr 25, 2024
@hahnjo hahnjo added this to Issues in Fixed in 6.30.08 Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

5 participants