Nugetgallery: [Speculative bug] Package.DownloadCount is going to eventually overflow

Created on 1 Apr 2021  路  5Comments  路  Source: NuGet/NuGetGallery

Describe the bug

We were admiring Json.NET's almost 1 billion download count today. I was curious about the data type used to store this value in the gallery. It looks like Package.DownloadCount is a int32 value and will eventually overflow to negative values. Might be prudent to update that property and everything that touches it to use a 64-bit integer.

Most helpful comment

Newtonsoft.Json is getting 74 million downloads every 6 weeks. If it stays constant, in about 80 weeks it will break Int32.MaxValue (2.1 billion)

All 5 comments

Newtonsoft.Json is getting 74 million downloads every 6 weeks. If it stays constant, in about 80 weeks it will break Int32.MaxValue (2.1 billion)

I think it is important to test what happens to clients. There will likely be some older clients out there that are no longer updated. What happens when they get int32.maxvalue+1?

Thanks @pranavkm and @JamesNK for bringing this to our attention.

We've been loosely following the numbers and have fixed some problems in this area already. For example it's possible that our front page total download count stopped updating one time suspiciously close to int.MaxValue several years back 馃檮. But a full analysis should be done since this will be the first time a _single_ package exceeds int.MaxValue.

I think overflowing to negative is a better case than, you know, VS UI crashing 馃槰. We need to dig through server and client side.

Thanks @loic-sharma for the initial analysis!

Just a suggestion, maybe manually move the download count down as it's moving up until you know everything is fixed. or have it as a backup plan on D-Day.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

heng-liu picture heng-liu  路  5Comments

scottbommarito picture scottbommarito  路  5Comments

gep13 picture gep13  路  4Comments

anangaur picture anangaur  路  5Comments

304NotModified picture 304NotModified  路  3Comments