Prevent overflow on StatsCollector.java#3932
Conversation
334864f to
33007f2
Compare
| s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN); | ||
| _usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN; | ||
| } | ||
| _diskStatsUpdateExecutor.scheduleAtFixedRate(new VmDiskStatsUpdaterTask(), (endDate - System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000), |
There was a problem hiding this comment.
Potential overflow in 2 Values before it is converted to long by use in an invocation context.
| for (AutoScaleVmGroupPolicyMapVO asVmgPmap : listMap) { | ||
| AutoScalePolicyVO policyVO = _asPolicyDao.findById(asVmgPmap.getPolicyId()); | ||
| if (policyVO != null) { | ||
| Integer quitetime = policyVO.getQuietTime(); |
There was a problem hiding this comment.
The variable 'quitetime' is only assigned values of primitive type and is never 'null', but it is declared with the boxed type 'Integer'.
|
@blueorangutan package |
|
@GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✔centos7 ✔debian. JID-1000 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1191)
|
|
Thanks for all the reviews! Just to mention. I did a few manual tests to ensure that no overflow will happen. Setting ONE_MINUTE_IN_MILLISCONDS to Long (or long) will indeed solve overflow issues. |
|
@GabrielBrascher as this is a pure fix, will it apply to 4.13? |
borisstoyanov
left a comment
There was a problem hiding this comment.
@GabrielBrascher can you share some steps to reproduce this? I'm trying to find out what exactly we're trying to fix here.
|
@borisstoyanov the overflow is not something that will happen easily; however, the code is there and it still something that might happen one day depending on the value stored at The operation that I extracted can result in an overflow as it is an integer operation stored in an integer memory (and then after storing it as an integer it is cast into a long). I extracted it into a |
|
@DaanHoogland I see no problem in applying this at 4.13.1. |
|
ok, can you rebase @GabrielBrascher ? |
ff95beb to
38755ed
Compare
|
@DaanHoogland rebased it to 4.13 🙂 |
38755ed to
c4ea2ad
Compare
c4ea2ad to
b9aad0f
Compare
|
@blueorangutan package |
|
@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✔centos7 ✔debian. JID-1037 |
|
@blueorangutan test |
|
@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1225)
|
|
2 x LGTMs, all tests passing (those privategtw tests are "OK", fixed in newer ACS code - this PR is 150+ commits behind master) Merging. |
Description
Did a quick check and found an operation that can result in an overflow. Additionally, I took the liberty to do a couple of code enhancements/clean ups.
Types of changes