From 663bbb10487b3e1d469c3a4e31af34d92c217a1b Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 16 Dec 2016 17:15:04 +0100 Subject: [PATCH] Do not hide environment variables * Serialize callback execution. If the previous callback is still running - kill it Also it will fix a problem of zombie processes when executing callbacks from the main thread. * bugfix: pass an arguments to a callback --- patroni/callback_executor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/patroni/callback_executor.py b/patroni/callback_executor.py index e937d9eb..718af67a 100644 --- a/patroni/callback_executor.py +++ b/patroni/callback_executor.py @@ -1,5 +1,4 @@ import logging -import os import subprocess from threading import Event, Lock, Thread @@ -31,7 +30,7 @@ class CallbackExecutor(Thread): self._callback_event.clear() with self._lock: try: - self._process = subprocess.Popen(self._cmd, close_fds=True, env={'PATH': os.environ.get('PATH')}) + self._process = subprocess.Popen(self._cmd, close_fds=True) except Exception: logger.exception('Failed to execute %s', self._cmd) continue