Beego Advanced Programming---->GRACE Module Hot Restart causes the old process not to finish processing the request to exit directly

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Background:

Listen , listen, listen, listen, what's the heat escalation? Know nginx students know that Nginx is to support the hot upgrade, you can use the old process to service the link of the previous link, using the new process to service the new link, that is, without stopping the service to complete the system upgrade and run parameter modification.

Environment:


Reason:

ListenListen and listen and listen alongBeego Official Documentswhen graceful is turned on, the old connection does not continue to process when running the Kill-hup PID restart process, but it shuts down directly with the old process, causing the request to return 504. Hear


Solve:

Listen, listen. Listen and listen to in process. Kill () The new process of the parent process to kill directly, send a sigkill signal, the process will not be processed, directly killed, in fact, in the Handlesignals function does not deal with this signal. So the code changes to the following:
file: Grace /server.go, Function Listenandserve (), and Listenandservetls ()

 listen to//err = process. Kill () 
Listen and listen to err = process. Signal (OS. Interrupt)


At last:

Listen, listen, listen, hear and listen. The tests have been tested to finish the unfinished connection.



To demand-driven technology, the technology itself does not have a better point, only the division of business.

This article is from the "Sea" blog, be sure to keep this source http://lisea.blog.51cto.com/5491873/1895219

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.