-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faraday in Eio (some bugs) #77
Comments
The comment is probably not clear. The code does not wants to fix integer overflow but it wants to shift the problem more far than |
I don't see much point in just doubling the time until it fails. On 32-bit systems, it means that instead of failing after writing 1GB of data, it will instead fail after writing 2 GB. For 64-bit systems, it doesn't matter, of course. |
It's my little stone to the building 🙂 |
Hi, I needed a buffered writer in Eio, and I used Faraday as the basis of that (ocaml-multicore/eio#235). While reviewing the code, I fixed a few things that might want fixing here too.
Overflow
There is a comment in
shift_flushes
saying that it avoids overflow problems by subtracting both sides:faraday/lib/faraday.ml
Lines 392 to 410 in 3ea082b
This doesn't work; it just shifts the problem elsewhere (consider
bytes_written = -2
andthreshold = 8
, for example). I believe the test should bet.bytes_written - threshold >= 0
. /cc @dinosaureSafety
write_string
andwrite_bytes
both perform unsafe blits using offsets provided by the user:faraday/lib/faraday.ml
Lines 250 to 258 in 3ea082b
Serialize loop
If the user's
writev
function returnsClosed
then it can't consume anything and just calls it again, forever:faraday/lib/faraday.ml
Lines 436 to 444 in 3ea082b
License
BTW, Faraday uses the BSD-3-clause license, whereas Eio uses ISC. I included your headers and license in Eio, but if you're willing to let us use it as ISC it would simplify things slightly.
The text was updated successfully, but these errors were encountered: