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

Centralise payload ptr ownership for condition updating workflows #35048

Merged

Conversation

ggovi
Copy link
Contributor

@ggovi ggovi commented Aug 27, 2021

PR description:

A review of the overall CMSSW client code of the DBOutputService interface for creating/updating condition data sets (sequences of pairs iov/payload ), has found that the clients are mostly assuming (wrongly) the service to take over the ownership, resulting in a generalised memory leak.
Only few classes are currently implementing the policy correctly.
To cope with that, I propose the following changes:

  1. Implement a centralised policy in the service, taking over (as expected by most of the clients) the payload pointer ownership. This will happen by calling the already existing function signatures accepting a pointer as input: writeOne, createNewIOV, appendSinceTime. The called function will take care to free the allocated memory. For the caller, no change is strictly required if it does not free the memory after the call.
  2. Introduce a new set of methods with a reference-based signature for writeOne, createNewIOV and appendSinceTime.
    These new methods are used in this PR to migrate the code of the clients already holding the payload ptr ownership. In addition, all of the other clients, currently not freeing the payload memory, will be asked to move to this interface. This change will improve the overall memory management and the code readability.
  3. Introduce a new method "writeMany" scoped to the atomic update of many iovs/payloads. In this PR, this is used for a new implementation of the PopCon workflow.
  4. Modify the PopCon interface to provide a safer memory management: on the side of the existing vector m_to_transfer holding bare payload pointers has been added a new container ("m_iovs") of payloads based on shared_ptr. The client of PopCon are expected to migrate their code to replace the use of m_to_tranfer in favour of m_iovs.

PR validation:

Unit tests/Integration test/O2O tests

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35048/24919

  • This PR adds an extra 80KB to repository

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • CalibCalorimetry/CaloMiscalibTools (alca)
  • CalibTracker/SiPixelQuality (alca)
  • CalibTracker/SiStripESProducers (alca)
  • Calibration/LumiAlCaRecoProducers (alca)
  • CommonTools/ConditionDBWriter (db)
  • CondCore/DBOutputService (db, alca)
  • CondCore/PopCon (db, alca)
  • CondFormats/MFObjects (alca)
  • CondTools/RunInfo (db)
  • CondTools/SiPixel (db)
  • CondTools/SiStrip (db)
  • IOMC/EventVertexGenerators (simulation)
  • RecoHI/HiJetAlgos (reconstruction)

@malbouis, @civanch, @yuanchao, @tlampen, @mdhildreth, @cmsbuild, @jpata, @slava77, @ggovi, @pohsun, @francescobrivio, @tvami can you please review it and eventually sign? Thanks.
@echabert, @yslai, @pieterdavid, @robervalwalsh, @OzAmram, @thomreis, @seemasharmafnal, @dgulhan, @yenjie, @ferencek, @mandrenguyen, @yetkinyilmaz, @tocheng, @VinInn, @simonepigazzini, @mmusich, @fabiocos, @jan-kaspar, @gbenelli, @jazzitup, @dkotlins, @kurtejung, @tvami this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@@ -333,7 +333,7 @@ class ConditionDBWriter : public edm::EDAnalyzer {
edm::LogInfo("ConditionDBWriter") << "appending a new object to tag " << Record_ << " in since mode " << std::endl;

// The Framework will take control over the DB object now, therefore the release.
Copy link
Contributor

Choose a reason for hiding this comment

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

Now this comment is not in line with what's below it, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is wrong. Maybe, since it is a file that I have modified, better remove it. Good catch.

@ggovi
Copy link
Contributor Author

ggovi commented Aug 27, 2021

Please test

@tvami
Copy link
Contributor

tvami commented Aug 27, 2021

fixes #28699

@ggovi
Copy link
Contributor Author

ggovi commented Aug 27, 2021

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18100/summary.html
COMMIT: 40f6c27
CMSSW: CMSSW_12_1_X_2021-08-27-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/35048/18100/install.sh to create a dev area with all the needed externals and cmssw changes.

CMS StaticAnalyzer warnings: There are 2 EventSetupRecord::get warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18100/llvm-analysis/esrget-sa.txt for details.
CMS StaticAnalyzer warnings: There are 2 inherits from legacy modules warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18100/llvm-analysis/legacy-mod-sa.txt for details.

@slava77
Copy link
Contributor

slava77 commented Aug 28, 2021

+reconstruction

for #35048 40f6c27

  • code changes in reco are for a straightforward update in RecoHI/HiJetAlgos/plugins/UETableProducer.cc for the interface change in createNewIOV
  • jenkins tests pass

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35048/24954

  • This PR adds an extra 80KB to repository

@cmsbuild
Copy link
Contributor

Pull request #35048 was updated. @malbouis, @yuanchao, @tlampen, @pohsun, @francescobrivio, @tvami can you please check and sign again.

@tvami
Copy link
Contributor

tvami commented Aug 30, 2021

+alca

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs after it passes the integration tests. This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@ggovi
Copy link
Contributor Author

ggovi commented Aug 30, 2021

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18134/summary.html
COMMIT: 0eada5d
CMSSW: CMSSW_12_1_X_2021-08-29-2300/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/35048/18134/install.sh to create a dev area with all the needed externals and cmssw changes.

CMS StaticAnalyzer warnings: There are 2 EventSetupRecord::get warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18134/llvm-analysis/esrget-sa.txt for details.
CMS StaticAnalyzer warnings: There are 2 inherits from legacy modules warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccfe70/18134/llvm-analysis/legacy-mod-sa.txt for details.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 39
  • DQMHistoTests: Total histograms compared: 3000352
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3000324
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 38 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 165 log files, 37 edm output root files, 39 DQM output files
  • TriggerResults: no differences found

@tvami
Copy link
Contributor

tvami commented Aug 30, 2021

@tvami now it's there. thanks... we need the signatures again...

Interesting that GitHub didn't want the signatures again! Maybe changing comments doesn't trigger new signatures?

@@ -580,8 +580,6 @@ void CorrPCCProducer::dqmEndRunProduce(edm::Run const& runSeg, const edm::EventS
throw std::runtime_error("PoolDBService required.");
}

delete pccCorrections;
Copy link
Contributor

Choose a reason for hiding this comment

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

This deletion can (must) be avoided here because writeOne is used in its "deprecated" form: correct?
Shouldn't you try to move to the "non deprecated" form with the reference as argument, instead of the pointer?

Copy link
Contributor Author

@ggovi ggovi Aug 31, 2021

Choose a reason for hiding this comment

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

@perrotta The idea was to minimise the changes in this PR, and leave to the various code authors the migration to the new interface. Here we clearly had to options: 1. Remove the delete and leave the old interface 2. Leave the delete and move to new (reference-based) interface. I think 2 would not be fully satisfactory since we would be left with the use of pointers that has no justification. So, we should also remove the use of pointers.

@perrotta
Copy link
Contributor

It is curious that signatures were not reset after the last update in #35048 (comment) : @smuzaffar @mrodozov can you see any issue in the bot?
@cms-sw/reconstruction-l2 @cms-sw/simulation-l2 @cms-sw/db-l2 I imagine that you do not have any additional remark after that last update, which only removed an outdated comment... But we can wait a bit to merge, just in case you notice anything wrong after the final squash.

@smuzaffar
Copy link
Contributor

@perrotta , bot uses the timestamp of the latest commit and based on that it reset's the signatures. I think in this case the commit pushed were older than the signature comments

@perrotta
Copy link
Contributor

+1

  • Changes since last signature are only the removal of one outdated line
  • Nobody at the ORP meeting complained with it

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.

None yet

7 participants