Segfault when MCEvent is empty
This line of code is unprotected for the empty event cornercase: https://gitlab.cern.ch/lhcb/Allen/-/blob/master/host/event_model/MC/src/MCEvent.cpp#L49
In that case it would dereference a non-allocated space which results in a SEGFAULT
.
A basic fix would be to prevent it by adding:
if (input == NULL) return
This then backfires when destructing the MDFProvider
: https://gitlab.cern.ch/lhcb/Allen/-/blob/master/main/include/MDFProvider.h#L253 back tracking to https://gitlab.cern.ch/lhcb/Allen/-/blob/master/main/src/SliceUtils.cpp#L103, to the Allen::free_host()
call. I interpret this as a runtime error whenever freeig an already free chunk pointed memory section.
In order to reproduce this, use the master
branch under a validation sequence, with, for example the following line:
./toolchain/wrapper ./Allen --mdf /scratch/acasaisv/stack/jpsiee/mdf/dumped_file.mdf --sequence=hlt1_pp_veloSP_validation -m 2000 --host-memory 750 -g /scratch/acasaisv/stack/jpsi-newut2/geometry_upgrade/dddb-20210617_upgrade/sim-20210617-vc-md100/ -n 1955
Edit: although this is in itself a bug, I think the underlying reason is how slices are defined. Changing the number of events per slice to 2000 removes the bug.