AIDASoft / DD4hep

Detector Description Toolkit for High Energy Physics
http://dd4hep.cern.ch
GNU Lesser General Public License v3.0
50 stars 100 forks source link

Error in setDetectorTypeFlag: `map::at` #1350

Closed paulgessinger closed 2 days ago

paulgessinger commented 5 days ago

I'm trying to get DD4hep to work when built with Spack and used with ACTS to run OpenDataDetector workflows. I'm building a Spack environment with a number of ROOT specs, including dd4hep +ddg4 +xercesc and a view.

I supply that view to CMAKE_PREFIX_PATH when building ACTS. The build works, but at runtime, when constructing OpenDataDetector, DD4hep throws an exception map::at, ostensibly (from a stack trace in the debugger) from inside setDetectorTypeFlag.

I haven't seen this before, and indeed building DD4hep separately with manual builds of all dependencies does not exhibit this error. The XML or C++ construction code is unchanged, the only difference is the source of DD4hep and other dependencies.

Any ideas what might be causing this or what I could do to fix it?

andresailer commented 5 days ago

Check the build and configure logs from spack?

andresailer commented 5 days ago

Check which environment variables spack sets with respect to DD4hep.

paulgessinger commented 5 days ago

Nothing sticks out to me. I can share the full log on Monday.

I don't use the Spack to set up the environment to build ACTS with Dd4hep, so I don't get any environment variables from spack directly I don't think.

I source the thisdd4hep.sh directly. I can double check if Spack modifies the setup script.

paulgessinger commented 2 days ago

I debugged this a bit further, and from what I can tell the exception flies because (somehow) it seems the generic create_element function in SubdetectorAssembly_geo.cpp is invoked by the DD4hep geometry construction, which unconditionally calls setDetectorTypeFlag.

Now I think in a normal working scenario, this factory is not called, we don't have <type_flags> as a direct child of the subdetector in question that fails, so my best guess is that normally this code path isn't taken.

Is there some kind of fall-back mechanism for the detector element factories? I haven't seen this before, and the factory lookup mechanism is ~ magic to me.

I verified that the ODD factory library directory is first in the LD_LIBRARY_PATH.

The fact that it works on macOS indicates to me that it's related to the lookup order somehow.

andresailer commented 2 days ago

Not enough details.

MarkusFrankATcernch commented 2 days ago

This is true. setDetectorTypeFlag is called in SubdetectorAssembly_geo.cpp in line 37:

xml::setDetectorTypeFlag( e, sdet );

This call wants to see an child element called type_flags with an attribute type containing the detector type such as tracker, calorimeter,.... However, the exception is caught and not propagated. Hence the whole game is more a cosmetic issue. Is this correct ?

paulgessinger commented 2 days ago

Not enough details.

What kind of details do you want from me?

EDIT: Let me clarify. I feel like I've giving additional details in my previous update. Can you give me specific instructions what to try next to find the issue?

paulgessinger commented 2 days ago

@MarkusFrankATcernch

I think this factory function should not be called. This code runs fine as is without modification and does in fact run fine as is without Spack.

I'm trying to understand what Spack could be messing up in DD4hep's lookup logic on Linux.

MarkusFrankATcernch commented 2 days ago

I guess spack calls this function because it is part of a factory inspection mechanism of spack. In other works spack calls all factories defined by all components files in the LD_LIBRARY_PATH.

SubdetectorAssembly_geo.cpp defines such a factory and expects when called to receive an xml element with some structure. spack simply has no clue about this and hence also does not obeye this protocol.

This is my guess what is happening.

andresailer commented 2 days ago

Can you give me specific instructions what to try next to find the issue?

Please describe which version of spack you run on which operating system, which configuration you use to build DD4hep, which version of DD4hep and dependencies you use, which command with which parameters you execute and what the complete output log of that looks like.

It would be great to reduce the phase space of what DD4hep could potentially do to know what is is actually asked to do.

Thank you for your understanding!

PS:

andresailer commented 2 days ago

However, the exception is caught and not propagated. Hence the whole game is more a cosmetic issue. Is this correct ?

I assume (oh how I hate to assume this already...) that map::at throws an out_of_range error, which is not of type runtime_error, so it is not caught?

Maybe @paulgessinger could share the stacktrace as well...

paulgessinger commented 2 days ago
$ lsb_release -a
LSB Version:    n/a
Distributor ID: AlmaLinux
Description:    AlmaLinux 9.3 (Shamrock Pampas Cat)
Release:        9.3
Codename:       n/a
$ spack version
0.23.0.dev0 (a31c525778773b8c6a6fc35617454d954a05d74d)

Spack environment config is here:

spack:
  view: true
  # view:
  #   default:
  #     root: /scratch/pagessin/dev/ci-dependencies/copy_view2
      # link_type: copy
  specs:
  - boost@1.85.0 +program_options +test
  - cmake@3.30.1
  - edm4hep@0.10.5
  - eigen@3.4.0
  - git-lfs@3.5.1
  - intel-tbb@2021.12.0
  - nlohmann-json@3.11.3
  - podio@1.0.1
  - root@6.32.06 +aqua+opengl
  - dd4hep@1.29 +xercesc build_type=Debug
  - geomodel@6.3.0 +geomodelg4
  - python@3.12
  - hepmc3@3.3.0
  - pythia8@8.311
  - geant4@11.1.3 -data

  packages:
    all:
      target:
      - aarch64
      - x86_64
      variants: cxxstd=20 build_type=RelWithDebInfo
      require: "%gcc@11.4.1"

  concretizer:
    unify: when_possible

  config:
    install_tree:
      padded_length: 128

  mirrors:
    local-buildcache:
      url: oci://ghcr.io/acts-project/spack-buildcache
      signed: false

output of spack concretization is here:

[+]  boost@1.85.0%gcc@11.4.1~atomic~charconv~chrono~clanglibcpp~cobalt~container~context~contract~coroutine~date_time~debug~exception~fiber~filesystem~graph~graph_parallel~icu+iostreams~json~locale~log~math~mpi+multithreaded~nowide~numpy~pic+program_options~python~random~regex~serialization+shared~signals~singlethreaded~stacktrace~system~taggedlayout+test~thread~timer~type_erasure~url~versionedlayout~wave build_system=generic cxxstd=20 patches=a440f96 visibility=hidden arch=linux-almalinux9-x86_64
[+]      ^bzip2@1.0.8%gcc@11.4.1~debug~pic+shared build_system=generic arch=linux-almalinux9-x86_64
[+]          ^diffutils@3.10%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^gcc-runtime@11.4.1%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[e]      ^glibc@2.34%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^xz@5.4.6%gcc@11.4.1~pic build_system=autotools libs=shared,static arch=linux-almalinux9-x86_64
[+]      ^zlib-ng@2.2.1%gcc@11.4.1+compat+new_strategies+opt+pic+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^zstd@1.5.6%gcc@11.4.1+programs build_system=makefile compression=none libs=shared,static arch=linux-almalinux9-x86_64
[+]  cmake@3.30.1%gcc@11.4.1~doc+ncurses+ownlibs~qtgui build_system=generic build_type=RelWithDebInfo patches=dbc3892 arch=linux-almalinux9-x86_64
[+]      ^curl@8.10.1%gcc@11.4.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-almalinux9-x86_64
[+]          ^nghttp2@1.63.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^gmake@4.4.1%gcc@11.4.1~guile build_system=generic arch=linux-almalinux9-x86_64
[+]      ^ncurses@6.5%gcc@11.4.1~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=linux-almalinux9-x86_64
[+]  dd4hep@1.29%gcc@11.4.1+ddalign+ddcad+ddcond+dddetectors+dddigi+ddeve+ddg4+ddrec~debug~edm4hep~geant4units~hepmc3~ipo~lcio~tbb+utilityapps+xercesc build_system=cmake build_type=Debug generator=ninja arch=linux-almalinux9-x86_64
[+]      ^assimp@5.4.3%gcc@11.4.1~ipo+shared build_system=cmake build_type=Release generator=make arch=linux-almalinux9-x86_64
[+]          ^cmake@3.30.1%gcc@11.4.1~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release patches=dbc3892 arch=linux-almalinux9-x86_64
[+]      ^ninja@1.12.1%gcc@11.4.1+re2c build_system=generic arch=linux-almalinux9-x86_64
[+]          ^python@3.11.9%gcc@11.4.1+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=linux-almalinux9-x86_64
[+]              ^gettext@0.22.5%gcc@11.4.1+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-almalinux9-x86_64
[+]                  ^libxml2@2.10.3%gcc@11.4.1+pic~python+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^openssl@3.3.1%gcc@11.4.1~docs+shared build_system=generic certs=mozilla arch=linux-almalinux9-x86_64
[+]          ^re2c@3.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^py-pytest@8.2.1%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-iniconfig@2.0.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]              ^py-hatch-vcs@0.4.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]              ^py-hatchling@1.25.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]                  ^py-editables@0.5%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]                  ^py-pathspec@0.11.1%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]                  ^py-trove-classifiers@2023.8.7%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]                      ^py-calver@2022.6.26%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-packaging@24.1%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-pip@23.1.2%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]          ^py-pluggy@1.5.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-setuptools@69.2.0%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]          ^py-setuptools-scm@8.0.4%gcc@11.4.1+toml build_system=python_pip arch=linux-almalinux9-x86_64
[+]              ^py-tomli@2.0.1%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]              ^py-typing-extensions@4.12.2%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-wheel@0.41.2%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]      ^python-venv@1.0%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]      ^xerces-c@3.2.5%gcc@11.4.1 build_system=autotools cxxstd=20 netaccessor=curl transcoder=gnuiconv arch=linux-almalinux9-x86_64
[+]          ^libiconv@1.17%gcc@11.4.1 build_system=autotools libs=shared,static arch=linux-almalinux9-x86_64
[+]  edm4hep@0.10.5%gcc@11.4.1~ipo build_system=cmake build_type=RelWithDebInfo cxxstd=20 generator=make arch=linux-almalinux9-x86_64
[+]      ^py-jinja2@3.1.4%gcc@11.4.1~i18n build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-flit-core@3.9.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^py-markupsafe@2.1.3%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]      ^py-pyyaml@5.4.1%gcc@11.4.1+libyaml build_system=python_pip arch=linux-almalinux9-x86_64
[+]          ^libyaml@0.2.5%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  eigen@3.4.0%gcc@11.4.1~ipo build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]  geant4@11.1.3%gcc@11.4.1~data~hdf5~ipo~motif~opengl~qt~tbb+threads~timemory~vecgeom~vtk~x11 build_system=cmake build_type=RelWithDebInfo cxxstd=20 generator=make arch=linux-almalinux9-x86_64
[+]      ^clhep@2.4.7.1%gcc@11.4.1~cms~ipo build_system=cmake build_type=RelWithDebInfo cxxstd=20 generator=make arch=linux-almalinux9-x86_64
[+]      ^expat@2.6.3%gcc@11.4.1+libbsd build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^libbsd@0.12.2%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libmd@1.0.4%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  geomodel@6.3.0%gcc@11.4.1~examples~fsl~fullsimlight+geomodelg4~ipo~tools~visualization build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]      ^sqlite@3.46.0%gcc@11.4.1+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-almalinux9-x86_64
[+]  git-lfs@3.5.1%gcc@11.4.1 build_system=makefile arch=linux-almalinux9-x86_64
[+]      ^git@2.45.2%gcc@11.4.1+man+nls+perl+subtree~svn~tcltk build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^autoconf@2.72%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^automake@1.16.5%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^libidn2@2.3.7%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libunistring@1.2%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^libtool@2.4.7%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^findutils@4.9.0%gcc@11.4.1 build_system=autotools patches=440b954 arch=linux-almalinux9-x86_64
[+]          ^m4@1.4.19%gcc@11.4.1+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-almalinux9-x86_64
[+]              ^libsigsegv@2.14%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^openssh@9.8p1%gcc@11.4.1+gssapi build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^krb5@1.21.3%gcc@11.4.1+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]                  ^bison@3.8.2%gcc@11.4.1~color build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libedit@3.1-20240808%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^pcre2@10.44%gcc@11.4.1~jit+multibyte build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^perl@5.40.0%gcc@11.4.1+cpanm+opcode+open+shared+threads build_system=generic arch=linux-almalinux9-x86_64
[+]              ^berkeley-db@18.1.40%gcc@11.4.1+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-almalinux9-x86_64
[+]      ^go@1.23.2%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]          ^bash@5.2%gcc@11.4.1 build_system=autotools patches=094b4fd,155853b,1c48cec,2500a3f,2fb107c,325c268,3882772,3ef9246,45cc5e1,4641dd4,5138f48,6a090cd,6b4bd92,78b5230,831b5f2,8334b88,96ee1f5,9715344,af90550,b6fc252,c7705e0,d1e0566,ece0eb5,ef73905,f42f2fe,f95a817 arch=linux-almalinux9-x86_64
[+]          ^go-bootstrap@1.20.6%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]          ^grep@3.11%gcc@11.4.1~pcre build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^sed@4.9%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  hepmc3@3.3.0%gcc@11.4.1~interfaces~ipo~protobuf~python~rootio build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]  intel-tbb@2021.12.0%gcc@11.4.1~ipo+shared+tm build_system=cmake build_type=RelWithDebInfo cxxstd=default generator=make arch=linux-almalinux9-x86_64
[+]      ^hwloc@2.11.1%gcc@11.4.1~cairo~cuda~gl~libudev+libxml2~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-almalinux9-x86_64
[+]          ^libpciaccess@0.17%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  nlohmann-json@3.11.3%gcc@11.4.1~ipo+multiple_headers build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]  podio@1.0.1%gcc@11.4.1~ipo~rntuple~sio build_system=cmake build_type=RelWithDebInfo cxxstd=20 generator=make arch=linux-almalinux9-x86_64
[+]      ^py-graphviz@0.13.2%gcc@11.4.1~dev~docs build_system=python_pip arch=linux-almalinux9-x86_64
[+]      ^py-tabulate@0.9.0%gcc@11.4.1 build_system=python_pip arch=linux-almalinux9-x86_64
[+]  pythia8@8.311%gcc@11.4.1~evtgen~fastjet~gzip~hdf5+hepmc+hepmc3~lhapdf~madgraph5amc~mpich~openmpi~python~rivet~root+shared build_system=autotools cxxstd=20 patches=5e1a152 arch=linux-almalinux9-x86_64
[+]      ^hepmc@2.06.11%gcc@11.4.1~ipo build_system=cmake build_type=RelWithDebInfo generator=make length=MM momentum=GEV arch=linux-almalinux9-x86_64
[+]      ^rsync@3.3.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^popt@1.19%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  python@3.12.5%gcc@11.4.1+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic arch=linux-almalinux9-x86_64
[+]      ^gdbm@1.23%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^gettext@0.22.5%gcc@11.4.1+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^tar@1.34%gcc@11.4.1 build_system=autotools zip=pigz arch=linux-almalinux9-x86_64
[+]              ^pigz@2.8%gcc@11.4.1 build_system=makefile arch=linux-almalinux9-x86_64
[+]      ^libffi@3.4.6%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libxcrypt@4.4.35%gcc@11.4.1~obsolete_api build_system=autotools patches=4885da3 arch=linux-almalinux9-x86_64
[+]      ^openssl@3.4.0%gcc@11.4.1~docs+shared build_system=generic certs=mozilla arch=linux-almalinux9-x86_64
[+]          ^ca-certificates-mozilla@2023-05-30%gcc@11.4.1 build_system=generic arch=linux-almalinux9-x86_64
[+]      ^pkgconf@2.2.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^readline@8.2%gcc@11.4.1 build_system=autotools patches=bbf97f1 arch=linux-almalinux9-x86_64
[+]      ^util-linux-uuid@2.40.2%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]  root@6.32.06%gcc@11.4.1+aqua~arrow~cuda~cudnn+davix~dcache~emacs+examples~fftw~fits~fortran+gdml+gminimal~graphviz+gsl+http~ipo+math+minuit~mlp~mysql+opengl~postgres~pythia8+python~r+roofit+root7+rpath~shadow~spectrum~sqlite~ssl+tbb+threads~tmva~tmva-cpu~tmva-gpu~tmva-pymva~tmva-sofie+unuran~vc+vdt~veccore+webgui+x+xml~xrootd build_system=cmake build_type=RelWithDebInfo cxxstd=20 generator=make patches=22af347 arch=linux-almalinux9-x86_64
[+]      ^davix@0.8.7%gcc@11.4.1~ipo~thirdparty build_system=cmake build_type=RelWithDebInfo cxxstd=11 generator=make arch=linux-almalinux9-x86_64
[+]          ^rapidjson@1.2.0-2024-08-16%gcc@11.4.1~doc~ipo build_system=cmake build_type=RelWithDebInfo generator=make patches=ee123c7 arch=linux-almalinux9-x86_64
[+]      ^fcgi@2.4.2%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^fontconfig@2.15.0%gcc@11.4.1~pic build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^font-util@1.4.1%gcc@11.4.1 build_system=autotools fonts=encodings,font-adobe-100dpi,font-adobe-75dpi,font-adobe-utopia-100dpi,font-adobe-utopia-75dpi,font-adobe-utopia-type1,font-alias,font-arabic-misc,font-bh-100dpi,font-bh-75dpi,font-bh-lucidatypewriter-100dpi,font-bh-lucidatypewriter-75dpi,font-bh-type1,font-bitstream-100dpi,font-bitstream-75dpi,font-bitstream-speedo,font-bitstream-type1,font-cronyx-cyrillic,font-cursor-misc,font-daewoo-misc,font-dec-misc,font-ibm-type1,font-isas-misc,font-jis-misc,font-micro-misc,font-misc-cyrillic,font-misc-ethiopic,font-misc-meltho,font-misc-misc,font-mutt-misc,font-schumacher-misc,font-screen-cyrillic,font-sun-misc,font-winitzki-cyrillic,font-xfree86-type1 arch=linux-almalinux9-x86_64
[+]              ^bdftopcf@1.1.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]                  ^fontsproto@2.1.3%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]                  ^libxfont@1.5.4%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^mkfontdir@1.0.7%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^mkfontscale@1.2.3%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]                  ^libfontenc@1.1.8%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^gperf@3.1%gcc@11.4.1 build_system=autotools patches=3dd36db arch=linux-almalinux9-x86_64
[+]      ^freetype@2.13.2%gcc@11.4.1+pic+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^ftgl@2.4.0%gcc@11.4.1~ipo+shared build_system=cmake build_type=RelWithDebInfo generator=make patches=001908e arch=linux-almalinux9-x86_64
[+]      ^gl2ps@1.4.2%gcc@11.4.1~doc~ipo+png+zlib build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]      ^glew@2.2.0%gcc@11.4.1~ipo build_system=cmake build_type=RelWithDebInfo generator=make patches=7992e52 arch=linux-almalinux9-x86_64
[+]      ^glx@1.4%gcc@11.4.1 build_system=bundle arch=linux-almalinux9-x86_64
[+]      ^gsl@2.8%gcc@11.4.1~external-cblas+pic+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libice@1.1.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^util-macros@1.20.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^xtrans@1.5.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libjpeg-turbo@3.0.3%gcc@11.4.1~ipo~jpeg8~partial_decoder+pic build_system=cmake build_type=RelWithDebInfo generator=make libs=shared,static arch=linux-almalinux9-x86_64
[+]          ^nasm@2.16.03%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libpng@1.6.39%gcc@11.4.1~ipo~pic build_system=cmake build_type=RelWithDebInfo generator=make libs=shared,static arch=linux-almalinux9-x86_64
[+]      ^libsm@1.2.4%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libx11@1.8.10%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^inputproto@2.3.2%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^kbproto@1.0.7%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^libxcb@1.17.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libpthread-stubs@0.5%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libxau@1.0.11%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^libxdmcp@1.1.5%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^xcb-proto@1.17.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libxext@1.3.6%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libxft@2.3.8%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^libxrender@0.9.11%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]              ^renderproto@0.11.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libxml2@2.13.4%gcc@11.4.1+pic~python+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^libxpm@3.5.17%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^lz4@1.10.0%gcc@11.4.1+pic build_system=makefile libs=shared,static arch=linux-almalinux9-x86_64
[+]      ^mesa-glu@9.0.2%gcc@11.4.1 build_system=autotools patches=3d03e55 arch=linux-almalinux9-x86_64
[e]      ^opengl@4.6%gcc@11.4.1 build_system=bundle arch=linux-almalinux9-x86_64
[+]      ^pcre@8.45%gcc@11.4.1~jit+multibyte+pic+shared+static+utf build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^unuran@1.8.1%gcc@11.4.1~gsl+rngstreams+shared build_system=autotools arch=linux-almalinux9-x86_64
[+]          ^rngstreams@1.0.1%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^vdt@0.4.4%gcc@11.4.1~ipo~preload build_system=cmake build_type=RelWithDebInfo generator=make arch=linux-almalinux9-x86_64
[+]      ^xextproto@7.3.0%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^xproto@7.0.31%gcc@11.4.1 build_system=autotools arch=linux-almalinux9-x86_64
[+]      ^xxhash@0.8.2%gcc@11.4.1 build_system=makefile arch=linux-almalinux9-x86_64

Full configure + build output for DD4hep is here: build.txt

LD_LIBRARY_PATH:

/home/pagessin/dev/acts/build_spack/python/../thirdparty/OpenDataDetector/factory:/scratch/pagessin/dev/ci-dependencies/.spack-env/view/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/geant4-11.1.3-zjuun4l4nr4jd2fvuyfuvx6gzaxsz7vc/lib64:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/geant4-11.1.3-zjuun4l4nr4jd2fvuyfuvx6gzaxsz7vc/lib64:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/geant4-11.1.3-zjuun4l4nr4jd2fvuyfuvx6gzaxsz7vc/lib64:/home/pagessin/.local/acts-dev-rd-et.cern.ch/lib:/home/pagessin/.local/default/lib:/home/pagessin/.local/acts-dev-rd-et.cern.ch/lib:/home/pagessin/.local/default/lib::/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/clhep-2.4.7.1-zfid52nlo27zx352gdbxqw676xyif2gw/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/xerces-c-3.2.5-3xkaelge7hbr7pwff7ag5co2o5ed3hwj/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/clhep-2.4.7.1-zfid52nlo27zx352gdbxqw676xyif2gw/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/xerces-c-3.2.5-3xkaelge7hbr7pwff7ag5co2o5ed3hwj/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/clhep-2.4.7.1-zfid52nlo27zx352gdbxqw676xyif2gw/lib:/scratch/pagessin/spack-test/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__/linux-almalinux9-x86_64/gcc-11.4.1/xerces-c-3.2.5-3xkaelge7hbr7pwff7ag5co2o5ed3hwj/lib

GDB log is here: gdb.txt

The error seems to be thrown here: https://github.com/AIDASoft/DD4hep/blob/6c04cd74833125565b2160070fb7ed60c627094a/DDCore/src/XML/XMLElements.cpp#L719 so it seems to indeed be a runtime_error and not an out_of_range error as you suggested.

I run this script without any arguments, which through our infrastructure calls dd4hep::DetectorImp::fromCompact with the ODD top-level XML file.


I don't think the exception handling is really at fault here, it seems (to me) that this factory code hard-requiring a <type_flags> tag should not be called here.

andresailer commented 2 days ago

Thanks!

I run [this script]

Which script? Could link to this script and the top level ODD xml file you use, so I don't have to guess?

Where does the "map::at" from the title of the issue come from then?

paulgessinger commented 2 days ago

@andresailer copy-paste mistake, sorry. The script is this one: https://github.com/acts-project/acts/blob/main/Examples/Scripts/Python/full_chain_odd.py.

About the message: good point. I didn't look at the code in more detail, but the message should indeed be different. I realized that this was not the right exception, I didn't expect multiple exceptions to be thrown, so just looked at the first one.

I'm looking at the correct stack trace now, and am investigating.

MarkusFrankATcernch commented 2 days ago

I think the stack trace explains what is going wrong. The XML which enters does not have the node type_flags or this element has not an attribute type. Xerces exceptions then obviously do not inherit from std::runtime_error (Who has not caught here a const std::exception& ????) the exception runs through.

Paul you have to modify your xml and add this element to it. I checked a bit the history of XML/Utilities.cpp and this code seems to be present since at least 2 years.

andresailer commented 2 days ago

I think we shouldn't jump to conclusions, and let @paulgessinger print the stack trace for the actual uncaught exception?

paulgessinger commented 2 days ago

@andresailer's suggestion was correct. The stack trace was a bit confusing because ultimately the issue was (once again) the fact that Boost's flat_set has UB in boost 1.85. I was running on 1.85 unknowingly and didn't realize what was going because I was looking at the wrong stack trace.

I'm closing this, thanks all!