lucabaldini / xpedaq

Data acquisition software for the X-ray polarimetry explorers
GNU General Public License v2.0
0 stars 0 forks source link

Monitor crash #148

Open albertomanfreda opened 7 years ago

albertomanfreda commented 7 years ago

The monitor crashes consistently during the playback of data taken at the radiation test in Legnaro. The error messages produced are similar to the following:

Error in `./bin/xpemon': free(): invalid next size (normal): 0x00007f15b4005750 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f15dff407e5] /lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f15dff48e0a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f15dff4c98c] ./bin/xpemon[0x49d754]

followed by a very long sequence of unintelligible lines. The crashes occur always at the same position in the file (for example after ~15000 events from 003_0000118_data.mdat) so it is possible that they are caused by corrupted buffer headers. Note, however, that pEventReader::readPendingDatagram() already performs a check of validity on the incoming pDataBlocks:

pDataBlock p (reinterpret_cast<unsigned char*> (data), size);
  for (unsigned int evt = 0; evt < p.numEvents(); ++evt)
  {
    if (p.errorSummary() > 0)
    {
      std::cout << "Invalid event n. " <<  evt  << " of " << p;
      return;
    }

so it must be something that manages to escape this check (or either something else totally unrelated).

albertomanfreda commented 7 years ago

I just realized that this check does make no-sense (we can check only the whole buffer, not the single events). Proposed change:

pDataBlock p (reinterpret_cast<unsigned char*> (data), size);
  if (p.errorSummary() > 0){
    std::cout << "Invalid datablock: " << p;
    return;
  }
  for (unsigned int evt = 0; evt < p.numEvents(); ++evt)
  {

which, however, does not fix the above mentioned bug.