This is an archive of the discontinued Mercurial Phabricator instance.

rust-dirstate: panic if the DirstateMap counters go below 0
ClosedPublic

Authored by Alphare on Apr 4 2022, 11:30 AM.

Details

Summary

When modifying the API I hit some... interesting errors (trying to allocate
178GB of RAM, for example) because I failed to keep the counters correctly
updated.

This counter underflow is likely to happen when code is changed around
and can have up to eat-your-dirstate level of consequences, which is not nice.

The very small runtime cost of checking these counters should really not be an
issue and will help us uncover bugs when/if they do appear in the future.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Alphare created this revision.Apr 4 2022, 11:30 AM
Alphare updated this revision to Diff 32759.Apr 4 2022, 1:38 PM
baymax updated this revision to Diff 32764.Apr 4 2022, 2:33 PM

โœ… refresh by Heptapod after a successful CI run (๐Ÿ™ ๐Ÿ’š)
โš  This patch is intended for stable โš 

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.