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

Better exception message if module label in ESInputTag doesn't match #45947

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

wddgit
Copy link
Contributor

@wddgit wddgit commented Sep 6, 2024

PR description:

EventSetup data is uniquely identified by data type, record type, and product label. In the ESInputTag, one can additionally add the requirement that the module producing the data product also be associated with a specific module label. Before this PR, if the EventSetup fails to get a data product the system prints the same message in the case where the data type, record type, and product label cannot be found and in the case where a matching product is found but the module label does not match. This PR modifies the exception message to explicitly identify those cases where the only problem is that the module label does not match. This makes debugging problems easier.

This also includes a bug fix for the case of a "may consumes" EventSetup request that also requires a specific module label. See the changes in ESTagGetter.cc. There is nothing in CMSSW using that feature currently so this bug shouldn't be causing any problems (unless there is code using it that isn't in the repository...).

Note that one design decision was made implementing this. It would be nice to print out the module label requested in the ESInputTag and also the module label associated with the ESProducer in the case where there is a module label mismatch. That would make debugging even easier. But that information is not currently available at the point in code execution where the exception is constructed. It would require additional memory to make it available. Upon discussion between myself and Matti, we decided that it was better to save memory than to print out this info. Mainly this was based on how little this feature is used and how rare such exceptions are. It is not hard to figure those module labels given the information that is available.

PR validation:

Extended the unit test eventsetup_t.cppunit.cc to cover the cases related to the bug in ESTagGetter.cc. Also manually tested that all the exceptions were printing out nicely and formatted as expected in cases where the exceptions get thrown.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 6, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 6, 2024

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 6, 2024

A new Pull Request was created by @wddgit for master.

It involves the following packages:

  • FWCore/Framework (core)
  • FWCore/Utilities (core)
  • RecoLuminosity/LumiProducer (reconstruction)

@Dr15Jones, @cmsbuild, @jfernan2, @makortel, @mandrenguyen, @smuzaffar can you please review it and eventually sign? Thanks.
@felicepantaleo, @makortel, @missirol this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@wddgit
Copy link
Contributor Author

wddgit commented Sep 6, 2024

please test

for (auto const& item : lookup_) {
if (item.productLabel_ == iProductLabel) {
if (iProductLabel.empty() or iProductLabel == item.productLabel_) {
if (iModuleLabel.empty() or iModuleLabel == item.moduleLabel_) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the bug fix. iProductLabel -> iModuleLabel.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 7, 2024

-1

Failed Tests: UnitTests
Size: This PR adds an extra 72KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-712d6f/41386/summary.html
COMMIT: b099663
CMSSW: CMSSW_14_2_X_2024-09-06-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/45947/41386/install.sh to create a dev area with all the needed externals and cmssw changes.

Unit Tests

I found 1 errors in the following unit tests:

---> test testSiStripPayloadInspector had ERRORS

Comparison Summary

Summary:

  • You potentially added 7 lines to the logs
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 44
  • DQMHistoTests: Total histograms compared: 3328859
  • DQMHistoTests: Total failures: 8
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3328831
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 43 files compared)
  • Checked 193 log files, 163 edm output root files, 44 DQM output files
  • TriggerResults: no differences found

@makortel
Copy link
Contributor

makortel commented Sep 9, 2024

The unit test fails in the IB #45952

constexpr ESResolverIndex(ESResolverIndex&&) noexcept = default;

constexpr ESResolverIndex& operator=(ESResolverIndex const&) noexcept = default;
constexpr ESResolverIndex& operator=(ESResolverIndex&&) noexcept = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones Do you know if the compiler-generated copy/move constructors/assignment operators are constexpr ... noexcept by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking about this. I could just leave these 4 lines of code the way they were. It is kind of off the topic of the rest of the PR anyway. I just saw a rule of 5 violation (no destructor) and thought these were unnecessary. I'm not sure if the constexpr and noexcept are useful or not... Now that I'm looking the other two classes follow the same pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the simplest reading and I don't have a copy of the C++20 standard. After about an hour of research on google, I conclude the implicit copy/move constructor/assignment will be constexpr and noexcept if the content of the class allows that. For example, if the class had a data member that did not have a constexpr and noexcept copy constructor, then its implicit copy constructor would not be constexpr and noexcept. And there are lots of complex requirements for constexpr and noexcept to be possible.

In the case of ESResolverIndex, the implicit ones will be constexpr and noexcept.

The only advantage to declaring it explicitly is that if you really wanted that but made a mistake implementing your class (or later when you modified it) such that your class copy constructor could not be noexcept or constexpr, then the compiler would give an error on compilation.

@Dr15Jones I'd be happy to hear your opinion on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't think the compiler will give any error if you declare noexcept with a function that can throw and it only might give an error or warning for a constexpr function calling a non-constexpr function but the standard does not require a diagnostic... So declaring it explicitly doesn't help much.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matti, Chris, and I discussed this verbally. Summary: Implicitly declared functions would be constexpr and noexcept if used because the content of this class allows that, but it is better to explicitly declare this because the compiler will give useful diagnostic warnings in some cases. Soon, I will push a commit that restores those 4 lines and restart the tests.

});
iData = nullptr;
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check (and the one below) now effectively done elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these checks for error conditions duplicate error checks made elsewhere. It is impossible for these error checks to ever fail. This is true both before and after this PR.

We already check here:

https://cmssdt.cern.ch/lxr/source/FWCore/Framework/interface/EventSetupRecord.h#0166

that iResolverIndex does not have an invalid value and that other error check is always run first.

We already check here that pValue is not null:

https://cmssdt.cern.ch/lxr/source/FWCore/Framework/src/ESProductResolver.cc#0082

And that other error check is made first so the one I deleted couldn't ever fail.

It seemed better to me to get rid of that duplication, although I suppose one might argue it's good to check inside that function because it would cause problems if something outside the function changed and either of those conditions started failing... I can put them back in if you would prefer that, although I would have to think a bit about should be in the exception message in those cases.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #45947 was updated. @Dr15Jones, @cmsbuild, @jfernan2, @makortel, @mandrenguyen, @smuzaffar can you please check and sign again.

@wddgit
Copy link
Contributor Author

wddgit commented Sep 10, 2024

please test

All the comments received so far should be addressed. Let me know if there are more. Note that the RECO changes are trivial, 2 lines are deleted that include an unused header file.

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-712d6f/41445/summary.html
COMMIT: 35ea795
CMSSW: CMSSW_14_2_X_2024-09-10-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45947/41445/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 3 lines from the logs
  • Reco comparison results: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 44
  • DQMHistoTests: Total histograms compared: 3331158
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3331133
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 43 files compared)
  • Checked 193 log files, 163 edm output root files, 44 DQM output files
  • TriggerResults: no differences found

@jfernan2
Copy link
Contributor

+1

@makortel
Copy link
Contributor

+core

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @rappoccio, @sextonkennedy, @mandrenguyen, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 8f0aba6 into cms-sw:master Sep 11, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants