mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-05 12:37:56 +00:00
Do not let a missing pid file break the exit callback
The exit callback opened the pid file unguarded, so when it was already gone the atexit handler raised FileNotFoundError and python reported an exception ignored in an atexit callback. The removal of the debug socket immediately above is guarded, so this was an oversight rather than an intent. Verified by stopping the service with the pid file deleted first.
This commit is contained in:
@@ -230,10 +230,15 @@ def doexit():
|
||||
os.remove('/var/run/confluent/dbg.sock')
|
||||
except OSError:
|
||||
pass
|
||||
pidfile = open('/var/run/confluent/pid')
|
||||
pid = pidfile.read()
|
||||
if pid == str(os.getpid()):
|
||||
os.remove('/var/run/confluent/pid')
|
||||
try:
|
||||
with open('/var/run/confluent/pid') as pidfile:
|
||||
pid = pidfile.read()
|
||||
if pid == str(os.getpid()):
|
||||
os.remove('/var/run/confluent/pid')
|
||||
except OSError:
|
||||
# Someone else already tidied it up, which is not worth a traceback out
|
||||
# of an atexit callback
|
||||
pass
|
||||
|
||||
|
||||
def _initsecurity(config):
|
||||
|
||||
Reference in New Issue
Block a user