During the execution of the hd_root command with the parameters -PPLUGINS=occupancy_online, a breakpoint was added at src/programs/hd_root/MyProcessor.cc:~MyProcessor() to monitor the destructor of the event processor. However, the destructor never executed as expected. Conversely, when another breakpoint was placed at MyProcessor::Finish(), it was triggered, indicating an issue with the event processor's destructor execution.
Impact:
The absence of the destructor execution prevented the writing of data to the root file at the end of processing in hd_root. This issue hinders the expected functionality of the hd_root tool, potentially affecting data analysis and further processing.
Resolution:
To mitigate the issue, the code responsible for writing data to the root file was relocated from the destructor (~MyProcessor()) to the MyProcessor::Finish() method. This adjustment allowed the hd_root tool to populate the root files with the necessary data, resolving the immediate problem; however, the destructor is still not executing.
Closing resources should never happen in the destructor of any JANA components. That is what JEventSource::Close(), JFactory::Finish(), and JEventProcessor::Finish() are for.
Components' destructors get called when the JApplication context is destroyed, not before. I believe that halld_dump allocates a JApplication and then doesn't delete it. So even though JANA is now doing the correct thing, ~MyProcessor still won't be called in your setup. Which is fine for now, because of (1).
This is a memory leak, but for some reason Asan didn't detect it
Issue Identification:
During the execution of the
hd_root
command with the parameters-PPLUGINS=occupancy_online
, a breakpoint was added atsrc/programs/hd_root/MyProcessor.cc:~MyProcessor()
to monitor the destructor of the event processor. However, the destructor never executed as expected. Conversely, when another breakpoint was placed atMyProcessor::Finish()
, it was triggered, indicating an issue with the event processor's destructor execution.Impact:
The absence of the destructor execution prevented the writing of data to the root file at the end of processing in
hd_root
. This issue hinders the expected functionality of thehd_root
tool, potentially affecting data analysis and further processing.Resolution:
To mitigate the issue, the code responsible for writing data to the root file was relocated from the destructor (
~MyProcessor()
) to theMyProcessor::Finish()
method. This adjustment allowed thehd_root
tool to populate the root files with the necessary data, resolving the immediate problem; however, the destructor is still not executing.