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

graceful restart can not achieve zero-down #66

Open
Dev-Jabin opened this issue Dec 29, 2020 · 3 comments
Open

graceful restart can not achieve zero-down #66

Dev-Jabin opened this issue Dec 29, 2020 · 3 comments

Comments

@Dev-Jabin
Copy link

Dev-Jabin commented Dec 29, 2020

My project is built on the Beego, Now I want to graceful restart my project with Overseer. When I send kill -SIGUSR2 PID. I found that the current process was closed first, and then fork a new process. This will lead to a period of no work process in the middle, resulting in service denial of access. Unable to achieve zero-down

My project code

func main() {
overseer.Run(overseer.Config{
Program: prog,
Debug: true,
})
}

func prog(state overseer.State) {
beego.BConfig.RecoverPanic = true
beego.BConfig.Listen.Graceful = false
beego.Run()
}

Overseer log

2020/12/29 16:36:31 [overseer master] graceful restart triggered
2020/12/29 16:36:31 [overseer master] restart success
2020/12/29 16:36:31 [overseer slave#2] graceful shutdown requested
2020/12/29 16:36:31 [overseer slave#2] timeout. forceful shutdown
2020/12/29 16:36:31 [overseer master] prog exited with 1
2020/12/29 16:36:31 [overseer master] starting /Users/Demo

2020/12/29 16:36:34 [overseer slave#3] run
2020/12/29 16:36:34 [overseer slave#3] start program

Looking forward to your reply, Thank you!

@jpillora
Copy link
Owner

jpillora commented Dec 29, 2020 via email

@Dev-Jabin
Copy link
Author

You must use the overseer.State.Listener to receive zero-down time restarts

On 29 Dec 2020 at 7:38:08 pm, Dev-Jabin @.***> wrote: My project is built on the Beego, Now I want to graceful restart my project with Overseer. When I send kill -SIGUSR2 PID. I found that the current process was closed first, and then fork a new process. This will lead to a period of no work process in the middle, resulting in service denial of access. Unable to achieve zero-down My project code func main() { overseer.Run(overseer.Config{ Program: prog, Debug: true, }) } func prog(state overseer.State) { beego.BConfig.RecoverPanic = true beego.BConfig.Listen.Graceful = false beego.Run() } Overseer log 2020/12/29 16:36:31 [overseer master] graceful restart triggered 2020/12/29 16:36:31 [overseer master] restart success 2020/12/29 16:36:31 [overseer slave#2] graceful shutdown requested 2020/12/29 16:36:31 [overseer slave#2] timeout. forceful shutdown 2020/12/29 16:36:31 [overseer master] prog exited with 1 2020/12/29 16:36:31 [overseer master] starting /Users/Demo 2020/12/29 16:36:34 [overseer slave#3] run 2020/12/29 16:36:34 [overseer slave#3] start program Looking forward to your reply, Thank you! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#66>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2X4ZB2EUPQZTQGTAO73TSXGIPBANCNFSM4VM6U4WQ .

Thanks for your replay.
Now I update my project code as follows

main code

func main() {
	overseer.Run(overseer.Config{
		Program: prog,
		Address: ":8020",
		Debug:   true, //display log of overseer actions
	})
}

Ps: 8020 is my project listen port

prog code

func prog(state overseer.State) {
	http.Serve(state.Listener, nil)
	beego.BConfig.RecoverPanic = true
	beego.BConfig.Listen.Graceful = false
	beego.Run()
}

But I have another problem, How can I use my previous routers. e.g.

beego.Router("/soccer/biz/ping", &soccer_biz.IndexController{}, "Get:GetPong")

Now I curl http://127.0.0.1:8020/soccer/biz/ping return 404.

How to solve this problem? Thank you!

@jpillora
Copy link
Owner

jpillora commented Dec 29, 2020 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

2 participants