AndrasKovacs / flatparse

Fast parsing from bytestrings
MIT License
146 stars 12 forks source link

Forces values in in `withAnySizeUnnsafe#` #52

Closed qxjit closed 9 months ago

qxjit commented 9 months ago

This appears to fix a hard to uncover concurrency issue that I ran into while running Hedgehog properties in parallel to verify the encoding and decoding of data structures in our code. The tests would fail intermittently with only the multibyte integer values in the data structures shown as decoding incorrectly. Re-running the property with the failing seed would pass. Also running only 1 thread of tests or disabling the threaded runtime would also make the the tests pass.

AndrasKovacs commented 9 months ago

Thanks a lot!

That's a very sneaky thunk there. The second bang is not really needed, because the let-definition is for an unlifted type, so laziness is not possible.

qxjit commented 9 months ago

My pleasure! It was very sneaky indeed.

I see what you mean about the second bang not being needed. Would you like me to remove it and only force a explicitly?

AndrasKovacs commented 9 months ago

Yeah, please. Once again thanks for the fix.

qxjit commented 9 months ago

Done. And thank you for making FlatParse!