key4hep / k4LCIOReader

Generate EDM4hep collections from LCIO format data
Apache License 2.0
2 stars 11 forks source link

k4LCIOReader crashes when used in standalone application #26

Open FinnJohannsen opened 2 years ago

FinnJohannsen commented 2 years ago

Our goal is to implement the k4LCIOreader as a standalone application to read and convert LCIO files. We have run into a Segmentation Fault in edm4hep::ReconstructedParticleCollectionData::setReference, when trying this on miniDST files. Below is a list of commands to reproduce the error.

First you clone the github repository with the minimal reproducer and afterwards source the setup file from the nightlies.hsf to get the environment set up.

git clone --branch lcioedmconv https://gitlab.desy.de/ftx-sft-key4hep/edmconverter.git

source /cvmfs/sw-nightlies.hsf.org/spackages5/key4hep-stack/master-2022-08-03/x86_64-centos7-gcc11.2.0-opt/gmz2k/setup.sh

After that is done you build the reproducer.

cd edmconverter

mkdir build

cd build

cmake ..

make

download the miniDST file

cd ..

wget https://desycloud.desy.de/index.php/s/5LmrjGWqziQfMe7/download/rv01-16-p10_250.sv01-14-01-p00.mILD_o1_v05.E250-TDR_ws.I106479.Pe2e2h.eL.pR-00001-ILDminiDST.slcio

The programm is run with gdb to get the seg fault. Without gdb the programm just freezes in our case.

cd build

gdb -ex run --args ./minimalrep "../rv01-16-p10_250.sv01-14-01-p00.mILD_o1_v05.E250-TDR_ws.I106479.Pe2e2h.eL.pR-00001-ILDminiDST.slcio"

We are unsure whether this issue arises because the miniDST format has some Collections dropped. Or also because it has subset Collections. The Collection used in this case is not a subset Collection, but in a test case using a subset Collection the subset flag did not propagate through the program to the point where the references where set and the same seg fault came up.

FinnJohannsen commented 2 years ago

The same issue also happened with a few other data tiers.

In another attempt I replaced the store.get function with k4reader.getCollection. This finished without any issue. It seems things break as soon as podio tries to resolve relations. Does this mean that the k4LCIOReader does not handle relations?

andresailer commented 2 years ago

What do you mean by relations? LCRelation collections, or something else?

tmadlener commented 2 years ago

In this case relations are the OneToOneRelations/OneToManyRelations between edm4hep types, e.g. the crash above is when the ReconstructedParticles try to resolve their relations to the Vertex (in startVertex).

andresailer commented 2 years ago

But the crash also happens when you use k4reader.getCollection (I think this you have to do in any case)?

FinnJohannsen commented 2 years ago

I added the a changed version using k4reader.getCollection to the github called working_minimalrep.
By just doing every step the same as before and just replacing this line: gdb -ex run --args ./minimalrep "../rv01-16-p10_250.sv01-14-01-p00.mILD_o1_v05.E250-TDR_ws.I106479.Pe2e2h.eL.pR-00001-ILDminiDST.slcio" with this line: gdb -ex run --args ./working_minimalrep "../rv01-16-p10_250.sv01-14-01-p00.mILD_o1_v05.E250-TDR_ws.I106479.Pe2e2h.eL.pR-00001-ILDminiDST.slcio" The new Version gets run. It exits normally without any issues.

FinnJohannsen commented 2 years ago

I also tried calling k4reader.getCollection and only afterwards call store.get. This also crashes.