go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Graceful shutdown

Open wxwliris opened this issue 1 year ago • 9 comments

grpc 程序,接收到了kill信号,直接退出程序,并没等正在处理程序的协程处理结束后再退出

wxwliris avatar Jul 25 '22 12:07 wxwliris

Show the main function, and how to you kill the app?

kevwan avatar Jul 27 '22 15:07 kevwan

请问您的问题找到了吗? 我自己测试http服务,ctrl_c取消程序,也是直接退出,并没等正在处理程序的协程处理结束后再退出; 我看文档说,go zero的server.Start()方法会自动处理优雅重启的啊,没找到问题

answergong avatar Aug 10 '22 14:08 answergong

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Did you find your question? I tested the http service myself, ctrl_c canceled the program, and also exited directly, and did not wait for the coroutine processing of the processing program to end before exiting; I read the documentation and said that the server.Start() method of go zero will automatically handle graceful restarts, but I didn't find any problems.

Issues-translate-bot avatar Aug 10 '22 14:08 Issues-translate-bot

ctrl-c is not going to happy in service. Use kill to trigger graceful shutdown.

kevwan avatar Aug 10 '22 14:08 kevwan

i try to use kill pid to shutdown the prigram,but it also can not grace shut down,it still shutdow right now

answergong avatar Aug 10 '22 14:08 answergong

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 11 '23 01:08 github-actions[bot]

请问您的问题找到了吗? 我自己测试http服务,ctrl_c取消程序,也是直接退出,并没等正在处理程序的协程处理结束后再退出; 我看文档说,go zero的server.Start()方法会自动处理优雅重启的啊,没找到问题

测试最新版,仍然有这个问题。

s := rest.MustNewServer(*cfg)
s.Stop() // 执行后在进行中的请求全部立即返回了。

calvin2021y avatar Sep 05 '23 11:09 calvin2021y

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Did you find your problem? I tested the http service by myself, ctrl_c canceled the program, and exited directly, and did not wait for the coroutine processing of the program to finish before exiting; I read the document that go zero's server.Start( ) method will automatically handle graceful restart, no problem found

Tried the latest version and still have this problem.

s := rest.MustNewServer(*cfg)
s.Stop() // All requests in progress are returned immediately after execution.

Issues-translate-bot avatar Sep 05 '23 11:09 Issues-translate-bot

go-zero only handles SIGTERM, because in server, you never hit ctrl-c to running services.

kevwan avatar Sep 05 '23 16:09 kevwan