dream icon indicating copy to clipboard operation
dream copied to clipboard

Stop server on SIGTERM by default

Open yawaramin opened this issue 3 months ago • 3 comments

Fix #174

yawaramin avatar Sep 09 '25 16:09 yawaramin

Looks good!

I was wondering if we should also handle SIGQUIT but that already works. See also this discussion for the common signals to terminate processes. SIGHUP might be interesting at some point.

Willenbrink avatar Sep 09 '25 21:09 Willenbrink

if we should also handle SIGQUIT but that already works

In what context? I have SIGQUIT working in the shell to terminate Dream servers without this PR.

λ dune exec example/1-hello/hello.exe
03.10.25 07:11:33.858                       Running at http://localhost:8080
03.10.25 07:11:33.858                       Type Ctrl+C to stop
^\fish: Job 1, 'dune exec example/1-hello/hello…' terminated by signal SIGQUIT (Quit request from job control with core dump (^\))

But interestingly SIGTERM also also works:

λ dune exec example/1-hello/hello.exe
03.10.25 07:12:58.001                       Running at http://localhost:8080
03.10.25 07:12:58.001                       Type Ctrl+C to stop
^Zfish: Job 1, 'dune exec example/1-hello/hello…' has stopped

λ bg
Send job 1 'dune exec example/1-hello/hello.exe' to background

λ kill %1
λ fish: Job 1, 'dune exec example/1-hello/hello…' terminated by signal SIGTERM (Polite quit request)

This appears to be an issue inside containers. Is SIGQUIT relevant for Dream servers running inside containers?

aantron avatar Oct 03 '25 07:10 aantron

TODO: reconsider approach for multicore.

yawaramin avatar Oct 03 '25 13:10 yawaramin