fix zero period in PeriodGranularity causing infinite loop then OOM#3644
fix zero period in PeriodGranularity causing infinite loop then OOM#3644nishantmonu51 merged 1 commit intoapache:masterfrom
Conversation
gianm
left a comment
There was a problem hiding this comment.
cool, thanks for the fix. Does DurationGranularity need something similar?
There was a problem hiding this comment.
might as well toss this.period = Preconditions.checkNotNull(period, "period"); while we're here.
There was a problem hiding this comment.
please add a test for this in QueryGranularityTest, ideally one with deserialization.
|
DurationGranularity doesn't need this check, the construct will throw zero divide error if millis=0 |
|
ha, cool :) It'd be nice to have a check in DurationGranularity anyway, just to have a nicer error message. |
|
checkNotNull and test added, @gianm |
There was a problem hiding this comment.
suggest Assert.fail() here just to make sure the exception is actually thrown. Or, use the @Rule ExpectedException (example in FileTaskLogsTest)
|
thanks @kaijianding! |
|
👍 |
when construct PeriodGranularity with ZERO period like P0D, P0M, P0S... will cause infinite loop when calling gran.iterable(start, end), because the PeriodGranularity.next(long t) never move forward.
Finally, this issue will cause "out of heap space" error when makeCursors(...) and bring down the historical/realtime.