Segmentation violation when plotting with Garfield++

Hello,

The behavior started occurring after I pulled commit 3adfd42 (“Merge branch ‘PlottingEngine’ into ‘master’”). I have already tried building Garfield++ from scratch, but not even the default examples will work, only the ones that do not use ROOT to plot the results (e.g. Examples/GasFile/printTable.C). The segmentation violation only happens at the end of the program, after clicking on “Quit ROOT” on one of the canvases.

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x000070b9c92ea3ea in __GI___wait4 (pid=2871686, stat_loc=stat_loc
entry=0x7ffcd1c88c68, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x000070b9c92ea3ab in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffcd1c88c68, options=options
entry=0) at ./posix/waitpid.c:38
#2  0x000070b9c9250bdb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x000070b9c9b46d08 in TUnixSystem::StackTrace() () from /home/gabrielribcesario/miniconda3/envs/nnbar/lib/libCore.so.6.34
#4  0x000070b9c9b46606 in TUnixSystem::DispatchSignals(ESignals) () from /home/gabrielribcesario/miniconda3/envs/nnbar/lib/libCore.so.6.34
#5  <signal handler called>
#6  0x000060b2d8563f10 in ?? ()
#7  0x000070b9c9245a56 in __cxa_finalize (d=0x70b9ca36b000) at ./stdlib/cxa_finalize.c:83
#8  0x000070b9c9e98546 in __do_global_dtors_aux () from /home/gabrielribcesario/garfieldpp/install/lib/libGarfield.so.0.3
#9  0x00007ffcd1c8c280 in ?? ()
#10 0x000070b9cc7c924e in _dl_fini () at ./elf/dl-fini.c:142
===========================================================


The lines below might hint at the cause of the crash. If you see question
marks as part of the stack trace, try to recompile with debugging information
enabled and export CLING_DEBUG=1 environment variable before running.
You may get help by asking at the ROOT forum https://root.cern/forum
preferably using the command (.forum bug) in the ROOT prompt.
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs or (preferably) using the command (.gh bug) in
the ROOT prompt. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x000060b2d8563f10 in ?? ()
#7  0x000070b9c9245a56 in __cxa_finalize (d=0x70b9ca36b000) at ./stdlib/cxa_finalize.c:83
#8  0x000070b9c9e98546 in __do_global_dtors_aux () from /home/gabrielribcesario/garfieldpp/install/lib/libGarfield.so.0.3
#9  0x00007ffcd1c8c280 in ?? ()
#10 0x000070b9cc7c924e in _dl_fini () at ./elf/dl-fini.c:142
===========================================================

On an unrelated note, the linker warns of an unused variable rule for PlottingEngine when generating the Garfield++ dictionary. In line 10 of Include/Garfield/LinkDef.h:

#pragma link C++ global Garfield::PlottingEngine;

Shouldn’t the correct linking rule be “class” instead of “global” since Garfield::PlottingEngine is a class and not a global variable? Either way, editing the linking rule does not fix the segmentation violations.

Sincerely,
Gabriel

Hi @keithwm422,

Let me add @hschindl in the loop.

Cheers,

Dev

Hi @gabrielribcesario, thanks for spotting the bug with the linking rule!

Unfortunately I didn’t manage to reproduce the crash. Can you remind me what platform/compiler you are using?

Cheers,

H.

Hello,

I’ve been using GCC 14.3.0, which effectively fixed the TrackDegrade segmentation violations. I’ve been using Conda as a package manager as well as to be able to use the newer GCC versions on Ubuntu 22.04 and older platforms alike, so I’ll attach the environment.yml (wrapped in a .zip due to the forum’s restrictions on file extensions). If you have a Conda distribution installed then this should enable you, for the most part, to use the same environment as mine regardless of your platform.

environment.zip (3.1 KB)

Just a heads up: the environment.yml includes ROOT 6.34, so there might conflicts if you already are sourcing a ROOT distribution elsewhere (e.g. a binary distribution). It also includes other Garfield++ dependencies, such as GSL and CMake.