Delete any pre-existing watchdog command socket file at startup
authorMuhammad Usama <m.usama@highgo.ca>
Tue, 8 Dec 2020 10:15:50 +0000 (15:15 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Tue, 8 Dec 2020 10:20:39 +0000 (15:20 +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 b7dddb6f3c2bea9ae22962ae3348aef94f486a64..0760f18c46d5ce41232391ea334dade0147da3a9 100644 (file)
@@ -1207,13 +1207,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)
        {