Skip to content

Commit a9bea2a

Browse files
author
James William Pye
committed
Expand running() to remove the process when it's no longer running.
If a cluster is started with silent_mode=on, postgres will fork off and die leaving the dead subprocess. Postgres is running properly, but Cluster is foolishly looking at .daemon_process, not the pidfile.
1 parent 7fa2d3f commit a9bea2a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

postgresql/cluster.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,15 @@ def running(self):
382382
"""
383383
if self.daemon_process is not None:
384384
r = self.daemon_process.poll()
385-
return r is None
385+
if r is not None:
386+
pid = self.get_pid_from_file()
387+
if pid is not None:
388+
# daemon process does not exist, but there's a pidfile.
389+
self.daemon_process = None
390+
return self.running()
391+
return False
392+
else:
393+
return True
386394
else:
387395
pid = self.get_pid_from_file()
388396
if pid is None:

0 commit comments

Comments
 (0)