dream icon indicating copy to clipboard operation
dream copied to clipboard

finalize server setup & close Unix socket if needed

Open toastal opened this issue 6 months ago • 3 comments

Fixes #398

I’m not entirely sure what’s missing or if this is on my end. In my case I have been using dune exec bin/main.ml to launch where Dream.serve is called with Lwt_eio.run. I do not claim to be an expert in any sense on the topic.

[^1]

[^1]: Please consider giving up MS GitHub or offering a non-proprietary, non-US-corporate-controlled mirror for this free software project. I wish to delete this Microsoft account in the future, but I need more projects like this to support alternative methods to send patches & contribute.

toastal avatar Jun 07 '25 14:06 toastal

  • [ ] read up on man pages on sockets (POSIX)
  • [ ] identify whether socket cleanup should be handled upstream in lwt (how do other ecosystems do it?), and whether/how lwt tells us to create a socket that is cleaned up reliably (see docs at https://ocsigen.org/lwt/5.5.0/api/Lwt_unix)

sabine avatar Aug 08 '25 07:08 sabine

  • [ ] Make sure the cleanup is done when the process is exited by signal.
  • [ ] Document that Dream.serve does not do the cleanup.
  • [ ] Don't try to unlink an abstract Unix domain socket.

aantron avatar Aug 09 '25 06:08 aantron

After further discussion, it emerged that the common practice is to just optimistically delete the socket file before starting the server–if it doesn't exist then just carry on as normal.

@toastal are you able to change your PR to do this?

yawaramin avatar Sep 07 '25 19:09 yawaramin