Thanks for discussion.

I personally suggest solving the problem by modifying the systemd 
configuration.Without any code changes




The essence of the problem is that during shutdown, systemd sends a SIGTERM 
signal to the process. The network is terminated first, and when OpenVPN 
detects that the network has gone down, it calls the getaddrinfo() function to 
translate a domain name into an IP address. At this point, the parent process 
needs to wait for the child process to finish, and as a result, it misses the 
termination signal.



The only way to solve this problem is to introduce a child process that, upon 
receiving SIGTERM, kills the parent process and then exits itself.


However, this kind of "watchdog" mechanism is difficult to pass in Debian.


So simply modifying the systemd configuration will do.

Reply via email to