.Net client problem with byte to ulong binary conversion
Hi there, one of our counters last week reached a value greater than ~ 2B and started producing corrupt data (negative values).
We identified the issue to be on the Enyim client's method that parses ulong bytes. It looks as if half of the bytes gets parsed property, the other half doesn't.
I submitted an issue, unit test and temporary fix on the Github project:
but you guys might want to elevate priority on this since it can be really devastating for anyone relying on Memcached counters.
The fix I provided creates a new byte array in order to reverse the bytes and BitConverter to parse it. Using bit shifting would probably be more efficient, but the approach we took was guaranteed to produce a reliable value.
New unit tests should also be created to test all 8-byte integer conversions with values outside the 4-byte range. I *think* UInt64 encoding is working as expected, but you may want to take a closer look.