Comment #8 on issue 24160 by ero...@chromium.org: Crash on quit in DNS code http://code.google.com/p/chromium/issues/detail?id=24160
@jar: Ok, so I see the problem. Basically we have an "off by one" due to floating point rounding in how we choose buckets for samples. When initializing the buckets, we round: ----------------------- double linear_range = (min * (bucket_count() -1 - i) + max * (i - 1)) / (bucket_count() - 2); SetBucketRange(i, static_cast<int> (linear_range + 0.5)); ----------------------- Whereas when looking up the bucket we truncate: ----------------------- index = static_cast<size_t>(((value - declared_min()) * (bucket_count() - 2)) / (declared_max() - declared_min()) + 1); ----------------------- Because of the mismatch in how we treat edges, certain numbers will fall out of their appropriate bucket. For example, if you create a linear histogram with 52 buckets, min = 1 and max = 2000, consider what happens when you insert 1040: We start by picking these bucket ranges: range[26] = 1001 range[27] = 1040 <---- ROUND(1040.48) range[28] = 1080 But now when searching for the index, we do: index = CEIL(26.98799) = 26 So we are off by 1 (the truncation is implicit because of integer math). I believe the fix here is to just use CEIL when initializing the bucket ranges, in place of ROUND. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ Automated mail from issue updates at http://crbug.com/ Subscription options: http://groups.google.com/group/chromium-bugs -~----------~----~----~----~------~----~------~--~---