eio icon indicating copy to clipboard operation
eio copied to clipboard

file descriptor used after calling close!

Open anmonteiro opened this issue 1 year ago • 1 comments

  • 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?

    1. make Eio.Flow.close not throw (but perhaps leave the other operations throwing?)
    2. (at least) make the exception raised by Eio_luv.Handle.get easier to pattern match against. Right now the pattern needs to be Invalid_argument "close: handle used after calling close!" which feels a bit brittle.

anmonteiro avatar Sep 23 '22 21:09 anmonteiro

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.

talex5 avatar Sep 24 '22 11:09 talex5