Delete any pre-existing watchdog command socket file at startup
authorMuhammad Usama <m.usama@highgo.ca>
Tue, 8 Dec 2020 10:00:11 +0000 (15:00 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Tue, 8 Dec 2020 10:22:06 +0000 (15:22 +0500)
Abnormal termination of Pgpool leaves behind the dangling socket files
and prevent Pgpool-II from starting up.
The solution is to delete any pre-existing watchdog command socket
file before binding a watchdog command socket.

Patch provided by Masaya Kawamoto

src/watchdog/watchdog.c

index 47ece977c8fdfc1265fd8a85be0fa48e492d8086..3811616613c262a3382700b9c22bb247b4d49544 100644 (file)
@@ -1302,14 +1302,8 @@ wd_create_command_server_socket(void)
        ereport(INFO,
                        (errmsg("IPC socket path: \"%s\"", get_watchdog_ipc_address())));
 
-       if (get_watchdog_process_needs_cleanup())
-       {
-               /*
-                * If we are recovering from crash or abnormal termination of watchdog
-                * process. Unlink the old socket file
-                */
-               unlink(addr.sun_path);
-       }
+       /* Delete any pre-existing socket file to avoid failure at bind() time */
+       unlink(addr.sun_path);
 
        if (bind(sock, (struct sockaddr *) &addr, len) == -1)
        {