eio
eio copied to clipboard
file descriptor used after calling close!
-
https://github.com/ocaml-multicore/eio/issues/244 seemed like it had a different scope (specific to
accept_fork
), so I opened a new one. -
I'm hitting a case where I sometimes end up calling
Eio.Flow.close
a second time, and that blows up my application -
in cases where it's hard to guarantee that I only call
close
once, would it be reasonable to implement either one or both of the following?- make
Eio.Flow.close
not throw (but perhaps leave the other operations throwing?) - (at least) make the exception raised by
Eio_luv.Handle.get
easier to pattern match against. Right now the pattern needs to beInvalid_argument "close: handle used after calling close!"
which feels a bit brittle.
- make
Having a standard exception for this sounds sensible.
It's likely a bug if an application doesn't know whether it's closed an FD or not (since it might try to use it), but I imagine there are cases where it simplifies things.