unit icon indicating copy to clipboard operation
unit copied to clipboard

unix socket not closed on SIGTERM or SIGQUIT

Open echolimazulu opened this issue 3 years ago • 0 comments


Who is affected?

- All users of the unix socket as a listener


Hello Nginx Team and Contributors,

When a SIGTERM or a SIGQUIT signals are received, the unitd daemon does not close the existing unix: socket listener. On a subsequent restart of unitd with a configuration to use the same unix: socket, it becomes impossible due to a previously unclosed socket.

Also note: "32: Broken pipe" when closing processes.

Log:

# unitd
2022/02/13 12:20:13 [info] 31931#31931 unit 1.26.1 started

# ls -l /var/run/unit.sock
srw-rw-rw- 1 root root 0 Feb 13 12:20 /var/run/unit.sock

# kill -15 $(cat /var/run/unit.pid) && cat /var/log/unit.log
...
2022/02/13 12:21:43 [notice] 31958#31958 process 31960 exited with code 0
2022/02/13 12:21:43 [notice] 31958#31958 process 31961 exited with code 0
2022/02/13 12:21:43 [notice] 31962#31962 app process (isolated 31963) exited with code 0
2022/02/13 12:21:43 [alert] 31962#31962 sendmsg(13, -1, -1, 2) failed (32: Broken pipe)
2022/02/13 12:21:43 [notice] 31958#31958 process 31962 exited with code 0

# ls /var/run/unit.sock
srw-rw-rw- 1 root root 0 Feb 13 12:21 /var/run/unit.sock

# unitd
2022/02/13 12:22:35 [info] 31975#31975 unit 1.26.1 started

# cat /var/log/unit.log
...
2022/02/13 12:22:35 [alert] 31976#31976 bind(\"unix:/var/run/unit.sock\") failed (98: Address already in use)
2022/02/13 12:22:35 [alert] 31979#31979 failed to apply new conf
2022/02/13 12:22:35 [alert] 31978#31978 failed to apply previous configuration

echolimazulu avatar Feb 13 '22 12:02 echolimazulu