Skip to content
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

Reflex: Graceful Shutdown Issue with os.Interrupt Signal Intercept #98

Open
lordvidex opened this issue Jun 17, 2023 · 5 comments
Open

Comments

@lordvidex
Copy link

when running a server that has graceful shutdown logic intercepting the os signals, reflex intercepts them and prevent cleanup logic.

@escalopa
Copy link

Yeah, I got the same issue, I was running reflex -sr '\.go$' go run ./cmd/main.go where main.go has shutdown function on signals (SIGINT, SIGTERM), But it was not getting triggered

@dhax
Copy link

dhax commented Sep 14, 2023

What OS are you on? Because this exact same command is working just fine for me on linux zsh shell. This is my graceful shutdown logic:

server := &http.Server{
	Addr:    ":8000",
	Handler: myHandler,
}

go func() {
	if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
		log.Println("error while listening", err)
	}
}()

done := make(chan os.Signal, 1)
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
sig := <-done
log.Println("shutting down...")
...

@NoFacePeace
Copy link

NoFacePeace commented Sep 14, 2023 via email

@sn0rk64
Copy link

sn0rk64 commented Sep 28, 2024

感谢您的来信,我尽快回复您!

I have the same problem. Did you find any solution?

@NoFacePeace
Copy link

NoFacePeace commented Sep 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants