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

Range check issue in CTPPS breaking IB #35936

Closed
francescobrivio opened this issue Nov 1, 2021 · 15 comments
Closed

Range check issue in CTPPS breaking IB #35936

francescobrivio opened this issue Nov 1, 2021 · 15 comments

Comments

@francescobrivio
Copy link
Contributor

There is a(nother) crash observed in the last IB (spotted by @mmusich) which seems also related to CTPPS:
https://cmssdt.cern.ch/SDT/cgi-bin/logreader/slc7_amd64_gcc900/CMSSW_12_2_X_2021-10-31-2300/pyRelValMatrixLogs/run/136.8642_RunJetHT2018BHEfail+RunJetHT2018BHEfail+HLTDR2_2018+RECODR2_2018reHLT_skimJetHT_Prompt_HEfail+HARVEST2018_HEfail/step3_RunJetHT2018BHEfail+RunJetHT2018BHEfail+HLTDR2_2018+RECODR2_2018reHLT_skimJetHT_Prompt_HEfail+HARVEST2018_HEfail.log#/833

----- Begin Fatal Exception 01-Nov-2021 03:11:13 CET-----------------------
An exception of category 'StdException' occurred while
   [0] Processing  Event run: 317435 lumi: 36 event: 47465289 stream: 3
   [1] Running path 'dqmoffline_step'
   [2] Prefetching for module DQMMessageLogger/'DQMMessageLogger'
   [3] Prefetching for module LogErrorHarvester/'logErrorHarvester'
   [4] Calling method for module CTPPSProtonProducer/'ctppsProtons'
Exception Message:
A std::exception was thrown.
vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
----- End Fatal Exception -------------------------------------------------

It looks like an empty std::vector evaluated at(0).

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 1, 2021

A new Issue was created by @francescobrivio .

@Dr15Jones, @perrotta, @dpiparo, @makortel, @smuzaffar, @qliphy can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@francescobrivio
Copy link
Contributor Author

Not sure who should be assigned here.
FYI @cms-sw/ctpps-dpg-l2

@VinInn
Copy link
Contributor

VinInn commented Nov 1, 2021

good that the issue is cough. Still production code should not use .at. Please use operator[]

@jan-kaspar
Copy link
Contributor

good that the issue is cough. Still production code should not use .at. Please use operator[]

We can switch to []. For my education, why should it be preferred over at?

@mmusich
Copy link
Contributor

mmusich commented Nov 1, 2021

much faster

@jan-kaspar
Copy link
Contributor

much faster

Thanks!

@jan-kaspar
Copy link
Contributor

I understand that the operator[] preference holds for std::vector. Does the same apply for std::map? For map, there is a complication that operator[] is not const, while at() can be - thus useful for const getters e.g. here:
https://github.com/cms-sw/cmssw/blob/master/CondFormats/PPSObjects/interface/PPSAssociationCuts.h#L73

@makortel
Copy link
Contributor

makortel commented Nov 1, 2021

I understand that the operator[] preference holds for std::vector.

Correct. For operator[]() the validity of the index should be checked elsewhere or come from other guarantees. (i.e. it is best to organize code such that such guarantees can be cheaply given).

. Does the same apply for std::map? For map, there is a complication that operator[] is not const, while at() can be

No, as you pointed out. In std::map the difference between operator[]() and at() is that in case the key does not exist yet, [] adds a new element, whereas at() throws an exception (and if one needs to act differently than terminating the program when key is missing, one should use find()).

@VinInn
Copy link
Contributor

VinInn commented Nov 1, 2021

at shall not be used even in case of map we do not want exception to be thrown.
find shall be used

@VinInn
Copy link
Contributor

VinInn commented Nov 1, 2021

BTW: map should be avoided in reco code. There is essentially no use case for that.

@jan-kaspar
Copy link
Contributor

Hopefully, here's a fix: #35941.

@tvami
Copy link
Contributor

tvami commented Nov 2, 2021

assign alca

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 2, 2021

New categories assigned: alca

@yuanchao,@francescobrivio,@malbouis,@tvami you have been requested to review this Pull request/Issue and eventually sign? Thanks

@francescobrivio
Copy link
Contributor Author

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 4, 2021

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
Development

No branches or pull requests

7 participants