# compose


11/29/2021, 11:16 PM
What would happen, if Snapshot#*nextSnapshotId* reach max value? Next increment resets it to zero due to overflow, so "monotonically increasing" rule will break?

Chuck Jazdzewski [G]

11/29/2021, 11:48 PM
If more than 2^31 snapshots are taken then Snapshot.kt will start behaving in unpredictable ways and is likely to throw an exception but that is not guaranteed. Snapshot.kt should detect this case and, at least, throw a more meaningful error. It should be fixed in a feature release to handle overflowing the id correctly by either using Long internally (making overflow very unlikely as it would take 2^63 snapshots to be taken) or reset the id when it gets too high (which still would not guarantee to fix this as there the app might not give the snapshots a a condition in which it can reset the id). Do you mind submitting a bug for this and assigning it to me?

Kirill Grouchnikov

11/29/2021, 11:55 PM
Just reboot your Dreamliner every 248 days


11/29/2021, 11:57 PM
Personally, I didn't face such problem, just got curious while inspecting sources. So i'm not sure it requires a bug to be submitted