Skip to content

Commit 7b5659d

Browse files
committed
Close file descriptors before exec'ing collectors.
Without this we leak FD 3 to the children, which is typically used by the logging library to hold a reference to the current file (which will eventually get rotated and later possibly deleted).
1 parent 7ceeac4 commit 7b5659d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tcollector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,9 @@ def spawn_collector(col):
11311131
# ... load the py module directly instead of using a subprocess ...
11321132
try:
11331133
col.proc = subprocess.Popen(col.filename, stdout=subprocess.PIPE,
1134-
stderr=subprocess.PIPE, preexec_fn=os.setsid)
1134+
stderr=subprocess.PIPE,
1135+
close_fds=True,
1136+
preexec_fn=os.setsid)
11351137
except OSError, e:
11361138
LOG.error('Failed to spawn collector %s: %s' % (col.filename, e))
11371139
return

0 commit comments

Comments
 (0)