Bug #22914

WFViewer Segfaults

Added by Eric Flumerfelt about 1 year ago. Updated 11 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


I noticed during testing that the online monitor processes leave behind core files very frequently when running with e19:s82. I do not know when this behavior started, as the relevant code in WFViewer does not appear to have changed recently (though this could be due to changes in art's cleanup routines).

The segfaults always backtrace to the default delete of the unique_ptr<TCanvas>. Possible bugfixes include double-checking the memory allocations of WFViewer and/or adding a destructor to that class which handles things appropriately.


#1 Updated by Eric Flumerfelt about 1 year ago

  • Assignee set to Eric Flumerfelt
  • Status changed from New to Resolved

Running valgrind and gdb on art shows that the problem has to do with the order of destruction of art modules. Since in s82, RootApplication is shut down before WFViewer, the TCanvas and TFile objects are already destructed by the time WFViewer's destructor runs. Given that ROOT wants to be responsible for all ROOT objects attached to its file tree, I have implemented a destructor for WFViewer that simply sets the pointers to 0 (and changed all unique_ptrs to bare pointers).

Implementation on artdaq-demo:bugfix/22914_WFViewer_FixSegfaultInDefaultDestructor.

#2 Updated by John Freeman 11 months ago

  • % Done changed from 0 to 100
  • Status changed from Resolved to Reviewed

I've confirmed that for an e19:s82 build of artdaq-demo, switching from the head of develop (44d1a5ff7318859c21fcd64035a018d5513f05e4) to the head of bugfix/22914_WFViewer_FixSegfaultInDefaultDestructor (aeabc41cff91e232a3e7aba9766588bcbe698a95) gets rid of the segfault. To be specific, if I run over the first two events in the file mu2edaq01:/home/jcfree/daqdata/artdaqdemo_r002894_sr01_20190911T162546_1.root using the FHiCL document just below this text, the "Segmentation fault (core dumped)" which I see at the end when running with a develop branch build goes away when I run with a bugfix branch build.

modulus: 5

physics: {
  analyzers: {
    app: {
      module_type: RootApplication
      force_new: true
    wf: {
      module_type: WFViewer
      fragment_ids: [0, 1, 2, 3]
      fragment_type_labels: [TOY1, TOY2]
      prescale: 1
      digital_sum_only: false
    checkintegrity: {
      module_type: CheckIntegrity
      raw_data_label: daq
      frag_type: TOY1
    toyDump: {
      module_type: ToyDump
      raw_data_label: daq
      frag_type: TOY1
      num_adcs_to_show: 10   # Obviously this should be no more than ADC counts per fragment
      dump_to_screen: true
  a1: [app, wf]
  a2: [checkintegrity]
  a3: [toyDump]
  e1: [ out1 ]
  end_paths: [ a1 ]

outputs: {
  out1: {
    module_type: FileDumperOutput
    wantProductFriendlyClassName: true
    onlyIfPresent: true

process_name: RootInputShmem

#3 Updated by Eric Flumerfelt 11 months ago

  • Target version set to artdaq_demo v3_06_01
  • Status changed from Reviewed to Closed
  • Co-Assignees John Freeman added

Also available in: Atom PDF