1 2 3 | #include <signal.h> signal(SIGPIPE, SIG_IGN); //. |
And reconnect mysql database before wait_timeout reached.
refer to:
https://zhuanlan.zhihu.com/p/335138654
https://blog.csdn.net/chengcheng1024/article/details/108104507
https://zhuanlan.zhihu.com/p/36104903