Skip to content

Commit

Permalink
Direct stderr to /dev/null in wal-prefetch forks
Browse files Browse the repository at this point in the history
Without this change DaemonContext will close stderr for the forked
processes and that results in `gpg` printing a warning to stdout that
it had to reopen stderr. The warning will make lzop fail since the
input stream is not a valid archive anymore.

When `lzop` crashes it causes the prefetch process to get stuck since
the buffers between the processes are not properly closed and drained.

Fixes wal-e#264.
  • Loading branch information
deverant committed Aug 24, 2016
1 parent c6cee1f commit c6cb0c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wal_e/operator/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ def start_prefetches(seg, pd, how_many):
continue
elif os.fork() == 0:
pd.create(fs)
with daemon.DaemonContext():
# gpg sends garbage to stdout if it has to reopen stderr
# so we just direct stderr to /dev/null instead
with daemon.DaemonContext(stderr=open(os.devnull, 'w')):
os.execvp(
sys.argv[0],
sys.argv[:split] + ['wal-prefetch'] + [pd.base, fs.name])
Expand Down

0 comments on commit c6cb0c9

Please sign in to comment.