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 exception for undefined functions to FormulaEvaluator #22216
add exception for undefined functions to FormulaEvaluator #22216
Conversation
@@ -657,7 +664,12 @@ namespace { | |||
return info; | |||
} | |||
|
|||
return info; | |||
// throw exception if info still undefined and first char doesn't match variable name | |||
if( *iBegin == 'x' or *iBegin == 'y' or *iBegin == 'z' or *iBegin == 't' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to reuse the corresponding function from VariableFinder, but wasn't sure how to do. As checkStart of FunctionFinder checks for std::isalpha(iSymbol), all expressions that start with x/y/z/t are also parsed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dr15Jones : I agree with @kirschen that it would be preferable to use here the function coded in VariableFinder::checkStart(). Do you have any suggestion about how to do it?
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-22216/3362 |
A new Pull Request was created by @kirschen for master. It involves the following packages: CommonTools/Utils @perrotta, @cmsbuild, @monttj, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
-1 Tested at: bda5e01 You can see the results of the tests here: I found follow errors while testing this PR Failed tests: AddOn
I found errors in the following addon tests: cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi --conditions auto:run2_mc_l1stage1 --fast -n 100 --eventcontent AODSIM,DQM --relval 100000,1000 -s GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid,L1,DIGI2RAW,L1Reco,RECO,EI,VALIDATION --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --datatier GEN-SIM-DIGI-RECO,DQMIO --beamspot NominalCollision2015 --era Run2_25ns : FAILED - time: date Wed Feb 14 18:40:16 2018-date Wed Feb 14 18:35:46 2018 s - exit: 16640 |
Comparison job queued. |
the addon failure is in fastsim1 and seems unrelated to this PR
@fabiocos @skurz is this something already known and to be fixed soon? |
It is unrelated in fact, and #22202, now merged, should fix it.
Slava Krutelyov <notifications@github.com> ha scritto:
… the addon failure is in fastsim1 and seems unrelated to this PR
```
[0] Processing Event run: 1 lumi: 1 event: 13 stream: 3
[1] Running path 'simulation_step'
[2] Calling method for module FastSimProducer/'fastSimProducer'
Exception Message:
HelixTrajectory: should not be reached (no solution).
```
@fabiocos @skurz is this something already known and to be fixed soon?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#22216 (comment)
|
Comparison is ready @slava77 comparisons for the following workflows were not done due to missing matrix map:
Comparison Summary:
|
please test |
The code-checks are being triggered in jenkins. |
Just for reference (behavior expected...), an example of an exception thrown in case of unsupported functions (e.g. now after removing TMath::Exp again): Processing jec_issue_Dec2017.C... |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-22216/3389 |
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@Dr15Jones : while this update could be even accepted as such, as it was pointed out in #22216 (comment) and #22216 (comment) it would be preferable to re-use the corresponding function already coded for the VariableFinder. Since you were the original author of this code, do you have any suggestion about how doing it cleanly? Or would you suggest instead to get rid of it and just stick on what currently coded in this PR? |
What was the exact expression that originally failed? I added a simple test evaluating |
@Dr15Jones : The usage of "TMath::Exp" in a formula gave a segfault instead of any exception, as reported in #21851. That triggered this PR. If there is a better way to backpropagate a parsing error than what proposed here, happy to go with that. |
@kirschen I added the following unit test
and that does properly throw an exception. So just calling |
Just to clarify the intent of the parser, the idea is to allow multiple evaluators to try to parse the expression with a failing to parse be an allowed outcome. Hence, throwing an exception at the point intended could actually break the parser. |
After a bit of experimentation, and spotting a place in the code that could cause a segmentation fault, I found the following formula which can cause a crash
|
I believe I have a working fix in #22354 which will handle additional cases that could have lead to a segmentation fault. The ultimate problem was with how the code was handling a failure during the precedence order handling. |
@kirschen I appologize for not having looked more deeply at this problem myself in order to realize exactly where the problem lay. |
@kirschen , could you please verify if #22354 already fulfills your needs, and you can then close this PR, or if you think that the exception thrown here is still justified to be put in the code together with the fix proposed by @Dr15Jones ? |
Hi @Dr15Jones, #22354 gives a useful exception with the initial troublesome expression: @perrotta : Thanks for following up on this.. |
Follow-up on issue #21851