Swoole multi-process unexpected exit of the main process

Source: Internet
Author: User
The younger brother is working on a multi-process crawling service recently. now it is a master process with 10 sub-processes. if the sub-process unexpectedly exits, create a sub-process. However, if the main process unexpectedly exits the sub-process, it will not quit. The next time I create 10 sub-processes in this service, the total number will be 20... the younger brother is working on a multi-process crawling service recently. now it is a master process with 10 sub-processes. if the sub-process unexpectedly exits, create a sub-process.

However, if the main process unexpectedly exits the sub-process, it will not exit. The next time I open this service, I create 10 sub-processes. The total number is 20 sub-processes. in this way, not only the data in redis is messy, but the memory is also is there any good way to ensure that the main process is closed together with the following sub-processes if it unexpectedly ends ??

My idea is that every time the main process is started, exec executes the next shell script to close all the processes except the main process. I don't know what you think?

Reply content:

The younger brother is working on a multi-process crawling service recently. now it is a master process with 10 sub-processes. if the sub-process unexpectedly exits, create a sub-process.

However, if the main process unexpectedly exits the sub-process, it will not exit. The next time I open this service, I create 10 sub-processes. The total number is 20 sub-processes. in this way, not only the data in redis is messy, but the memory is also is there any good way to ensure that the main process is closed together with the following sub-processes if it unexpectedly ends ??

My idea is that every time the main process is started, exec executes the next shell script to close all the processes except the main process. I don't know what you think?

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.