Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test and improve error message when OutputModule SelectEvents refers to a Process that does not exist in history #44743

Closed
makortel opened this issue Apr 15, 2024 · 13 comments · Fixed by #44767

Comments

@makortel
Copy link
Contributor

The StdException failure reported in https://cms-talk.web.cern.ch/t/issues-with-run-379404/39046/1 was caused by an OutputModule SelectEvents to refer to a Process for which a TriggerResults data product did not exist. The exception message was just

----- Begin Fatal Exception 14-Apr-2024 18:15:47 CEST-----------------------
An exception of category 'StdException' occurred while
   [0] Calling EventProcessor::runToCompletion (which does almost everything after beginJob and before endJob)
Exception Message:
A std::exception was thrown.
vector::_M_range_check: __n (which is 4294967295) >= this->size() (which is 14)
----- End Fatal Exception -------------------------------------------------

We should make the exception message more clear, and also add tests for this case.

@makortel
Copy link
Contributor Author

assign core

@cmsbuild
Copy link
Contributor

New categories assigned: core

@Dr15Jones,@makortel,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 15, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

A new Issue was created by @makortel.

@rappoccio, @antoniovilela, @Dr15Jones, @makortel, @smuzaffar, @sextonkennedy can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor Author

Here is a minimal reproducer of the present exception message

import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

process.source = cms.Source("EmptySource")
process.maxEvents.input = 3

process.out = cms.OutputModule("SewerModule",
    SelectEvents = cms.untracked.PSet(
        SelectEvents = cms.vstring("nonexistent_path:NONEXISTENT_PROCESS")
    ),
    name = cms.string("out"),
    shouldPass = cms.int32(0)
)

process.ep = cms.EndPath(process.out)

@makortel
Copy link
Contributor Author

One test we did was to change these loops

for (unsigned int i = 0; i < n; ++i) {
returnValue.emplace_back(uncheckedIndexFrom(s.token(i)));
}
for (auto token : tokensForEndPaths_) {
returnValue.emplace_back(uncheckedIndexFrom(token));
}

to filter out the indices for which productResolverIndex() != ProductResolverIndexValues::ProductResolverIndexInvalid. In that case the OutputModule accepted the events where the Path and Process did not exist.

We should really think and decide what the behavior should be in this case.

@makortel
Copy link
Contributor Author

If the job reads a file, and the OutputModule SelectEvents asks for a non-existent Path from an existing Process, the OutputModule selects the events.

The behavior of non-existent Path and non-existent Process should be consistent. But we're not sure if silently accepting the Events is the correct or best approach.

@makortel
Copy link
Contributor Author

Stack trace of the exception

#0  0x00007ffff5ba52f1 in __cxxabiv1::__cxa_throw (obj=0x7ffff1d31540, tinfo=0x7ffff5d0b1a8 <typeinfo for std::out_of_range>, dest=0x7ffff5bba260 <std::out_of_range::~out_of_range()>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:81
#1  0x00007ffff5b9c355 in std::__throw_out_of_range_fmt(char const*, ...) [clone .cold] () from /cvmfs/cms.cern.ch/el8_amd64_gcc12/external/gcc/12.3.1-40d504be6370b5a30e3947a6e575ca28/lib64/libstdc++.so.6
#2  0x00007ffff7c59326 in std::vector<edm::propagate_const<std::shared_ptr<edm::ProductResolverBase> >, std::allocator<edm::propagate_const<std::shared_ptr<edm::ProductResolverBase> > > >::_M_range_check (
    this=<optimized out>, __n=<optimized out>) at /cvmfs/cms.cern.ch/el8_amd64_gcc12/external/gcc/12.3.1-40d504be6370b5a30e3947a6e575ca28/include/c++/12.3.1/bits/stl_vector.h:1153
#3  std::vector<edm::propagate_const<std::shared_ptr<edm::ProductResolverBase> >, std::allocator<edm::propagate_const<std::shared_ptr<edm::ProductResolverBase> > > >::at (__n=<optimized out>, this=<optimized out>)
    at /cvmfs/cms.cern.ch/el8_amd64_gcc12/external/gcc/12.3.1-40d504be6370b5a30e3947a6e575ca28/include/c++/12.3.1/bits/stl_vector.h:1194
#4  edm::Principal::prefetchAsync (this=<optimized out>, task=..., index=<optimized out>, skipCurrentProcess=<optimized out>, token=..., mcc=<optimized out>) at src/FWCore/Framework/src/Principal.cc:645
#5  0x00007ffff7cb683a in edm::Worker::prePrefetchSelectionAsync (this=0x7fffdef3fdc0, group=..., successTask=<optimized out>, token=..., id=..., iPrincipal=0x7fffdeee8790)
    at src/FWCore/Framework/src/Worker.cc:198
#6  0x00007ffff7c55432 in edm::Worker::doWorkAsync<edm::OccurrenceTraits<edm::EventPrincipal, (edm::BranchActionType)1> > (this=0x7fffdef3fdc0, task=..., transitionInfo=..., token=..., streamID=...,
    parentContext=..., context=0x7fffe406d090) at /build/mkortela/debug/tier0_Run379404/CMSSW_14_0_4/src/FWCore/Framework/interface/maker/Worker.h:1045
#7  0x00007ffff7c5582d in edm::WorkerInPath::runWorkerAsync<edm::OccurrenceTraits<edm::EventPrincipal, (edm::BranchActionType)1> > (context=0x7fffe406d090, streamID=..., token=..., info=..., iTask=...,
    this=<optimized out>) at /build/mkortela/debug/tier0_Run379404/CMSSW_14_0_4/src/FWCore/Framework/interface/WorkerInPath.h:119
#8  edm::Path::runNextWorkerAsync (this=0x7fffe4024b00, iNextModuleIndex=<optimized out>, iInfo=..., iToken=..., iID=..., iContext=0x7fffe406d090, iGroup=...) at src/FWCore/Framework/src/Path.cc:349
#9  0x00007ffff7c55b0f in edm::Path::processOneOccurrenceAsync (this=0x7fffe4024b00, iTask=..., iInfo=..., iToken=..., iStreamID=..., iStreamContext=0x7fffe406d090)
    at /build/mkortela/debug/tier0_Run379404/CMSSW_14_0_4/src/FWCore/Concurrency/interface/WaitingTaskHolder.h:78
#10 0x00007ffff7ca570c in edm::StreamSchedule::processOneEventAsync (this=0x7fffe406ce90, iTask=..., info=..., serviceToken=..., pathStatusInserters=...) at src/FWCore/Framework/src/StreamSchedule.cc:1088
#11 0x00007ffff7c85c41 in edm::Schedule::processOneEventAsync (this=<optimized out>, iTask=..., iStreamID=<optimized out>, info=..., token=...) at src/FWCore/Framework/src/Schedule.cc:1202

@makortel
Copy link
Contributor Author

This line

if (productResolverIndex != ProductResolverIndexAmbiguous) {

should also require the index to not be ProductResolverIndexValues::ProductResolverIndexInvalid

@makortel
Copy link
Contributor Author

The behavior of non-existent Path and non-existent Process should be consistent. But we're not sure if silently accepting the Events is the correct or best approach.

We think the job should fail if the SelectEvents refers to a non-existent TriggerResults data product.

@makortel
Copy link
Contributor Author

The exception for a non-existent Path is thrown via

#0  0x00007ffff5ba52f1 in __cxxabiv1::__cxa_throw (obj=0x7fffcb3c4d00, tinfo=0x7ffff79a6610 <typeinfo for edm::Exception>, dest=0x7ffff7970020 <edm::Exception::~Exception()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:81
#1  0x00007ffff7b9d31e in edm::EventSelector::initPathNames (this=0x7fffdeeaf440, pathNames=...) at src/FWCore/Framework/src/EventSelector.cc:167
#2  0x00007ffff7c1a7d8 in edm::EventSelector::acceptEvent (this=0x7fffdeeaf440, tr=...) at src/FWCore/Framework/src/EventSelector.cc:246
#3  0x00007ffff7cb60ba in edm::detail::NamedEventSelector::match (product=..., this=0x7fffdeeaf3c0) at /build/mkortela/debug/tier0_Run379404/CMSSW_14_0_4/src/FWCore/Framework/interface/TriggerResultsBasedEventSelector.h:35
#4  edm::detail::TriggerResultsBasedEventSelector::wantEvent (this=<optimized out>, ev=...) at src/FWCore/Framework/src/TriggerResultsBasedEventSelector.cc:158
#5  0x00007ffff7c4ce9e in edm::core::OutputModuleCore::prePrefetchSelection (this=0x7fffcb08e438, id=..., ep=..., mcc=<optimized out>) at src/FWCore/Framework/src/OutputModuleCore.cc:306
#6  0x00007ffff7cbb72d in operator() (__closure=0x7fffcb455960) at src/FWCore/Framework/src/Worker.cc:168
#7  edm::FunctorWaitingTask<edm::Worker::prePrefetchSelectionAsync(tbb::detail::d1::task_group&, edm::WaitingTask*, const edm::ServiceToken&, edm::StreamID, const edm::EventPrincipal*)::<lambda(const std::__exception_ptr::exception_ptr*)> >::execute(void) (this=0x7fffcb455940)

@makortel
Copy link
Contributor Author

makortel commented May 1, 2024

+core

@cmsbuild
Copy link
Contributor

cmsbuild commented May 1, 2024

This issue is fully signed and ready to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants