While testing manalyzer, I found that it dies from an exception on odbxx, error message is "/home/olchansk/packages/midas/include/odbxx.h:1231: No "handle"
attribute found in XML data".
Indeed, my data file is very old and it's XML ODB dump does not have the "handle" attribute:
daq00:midas$ more ~/git/midas/manalyzer/run9402bor.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- created by MXML on Tue Aug 11 14:47:16 2020 -->
<odb root="/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://midas.psi.ch/odb.xsd">
<dir name="Experiment">
<key name="ODB timeout" type="INT32">10000</key>
While current MIDAS XML ODB dumps have it:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- created by MXML on Thu May 21 20:37:06 2026 -->
<odb root="/" filename="odb.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="/home/olchansk/packages/midas/odb.xsd">
<dir name="System" handle="135320">
<dir name="Flush" handle="135408">
<key name="Flush period" type="UINT32" handle="135496">60</key>
And odbxx requires this attribute unconditionally:
if (mxml_get_attribute(node, "handle") == nullptr)
mthrow("No \"handle\" attribute found in XML data");
o->set_hkey(std::stoi(std::string(mxml_get_attribute(node, "handle"))));
The "handle" attribute was added to XML ODB dumps in September 2024 (not sure to what purpose, JSON ODB dumps do not have a "handle" attribute):
git blame src/odb.cxx
...
dd23558fbd src/odb.cxx (Stefan Ritt 2024-09-20 15:30:00 +0200 9387) mxml_write_attribute(writer, "handle", std::to_string(hKey).c_str());
This change makes MIDAS data files written before this date un-analyzable (unless odbxx is turned off).
I can prevent manalyzer from crashing by catching the exception, but I think it is better if odbxx code is updated to accept the pre-Sep-2024 ODB XML data
format (which were valid XML ODB dumps when they were made and users are stuck with them inside compress binary MIDAS data files).
P.S. also please check the odbxx code for other crashes on malformed XML ODB dumps, it should complain, fail to load the dump, but not core dump or abort.
Malformed ODB dumps is not a theoretical situation, I am currently looking at MIDAS data files (mid.lz4) that have invalid JSON ODB dumps created from
corrupted ODB. Luckily the JSON parser handles this gracefully, does not crash manalyzer and I can look at the data. I did have to go 10 runs into the past
to find an uncorrupted ODB dump to reload a good ODB. Fixes to the JSON encoder and fixes for corrupt ODB are in progress.
K.O. |