Skip to content

Commit

Permalink
Handle broken pipes in arc_summary
Browse files Browse the repository at this point in the history
Using a command similar to 'arc_summary.py | head' causes
a broken pipe exception. Gracefully exit in the case of a
broken pipe in arc_summary.py.

Requires-Builders: test style
Signed-off-by: Giuseppe Di Natale <[email protected]>
Closes #6965
  • Loading branch information
dinatale2 committed Dec 17, 2017
1 parent f6940bb commit 4803edd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
12 changes: 6 additions & 6 deletions TEST
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
#TEST_PREPARE_SHARES="yes"

### SPLAT
#TEST_SPLAT_SKIP="yes"
TEST_SPLAT_SKIP="yes"
#TEST_SPLAT_OPTIONS="-acvx"

### ztest
#TEST_ZTEST_SKIP="yes"
TEST_ZTEST_SKIP="yes"
#TEST_ZTEST_TIMEOUT=1800
#TEST_ZTEST_DIR="/var/tmp/"
#TEST_ZTEST_OPTIONS="-V"
#TEST_ZTEST_CORE_DIR="/mnt/zloop"

### zimport
#TEST_ZIMPORT_SKIP="yes"
TEST_ZIMPORT_SKIP="yes"
#TEST_ZIMPORT_DIR="/var/tmp/zimport"
#TEST_ZIMPORT_VERSIONS="master installed"
#TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master installed"
#TEST_ZIMPORT_OPTIONS="-c"

### xfstests
#TEST_XFSTESTS_SKIP="yes"
TEST_XFSTESTS_SKIP="yes"
#TEST_XFSTESTS_URL="https://github.com/behlendorf/xfstests/archive/"
#TEST_XFSTESTS_VER="zfs.tar.gz"
#TEST_XFSTESTS_POOL="tank"
Expand All @@ -39,10 +39,10 @@
#TEST_ZFSTESTS_ITERS="1"
#TEST_ZFSTESTS_OPTIONS="-vx"
#TEST_ZFSTESTS_RUNFILE="linux.run"
#TEST_ZFSTESTS_TAGS="functional"
TEST_ZFSTESTS_TAGS="misc"

### zfsstress
#TEST_ZFSSTRESS_SKIP="yes"
TEST_ZFSSTRESS_SKIP="yes"
#TEST_ZFSSTRESS_URL="https://github.com/nedbass/zfsstress/archive/"
#TEST_ZFSSTRESS_VER="master.tar.gz"
#TEST_ZFSSTRESS_RUNTIME=300
Expand Down
13 changes: 9 additions & 4 deletions cmd/arc_summary/arc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import os
import sys
import time
#import errno

from subprocess import Popen, PIPE
from decimal import Decimal as D
Expand Down Expand Up @@ -1010,10 +1011,14 @@ def main():
else:
pages = unSub

zfs_header()
for page in pages:
page(Kstat)
sys.stdout.write("\n")
try:
zfs_header()
for page in pages:
page(Kstat)
sys.stdout.write("\n")
except IOError as e:
if e.errno == errno.EPIPE:
sys.exit()


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ while [[ $i -lt ${#args[*]} ]]; do
((i = i + 1))
done

log_must eval "arc_summary.py | head"
log_must eval "arc_summary.py | head -1"

log_pass "arc_summary.py generates output and doesn't return an error code"

0 comments on commit 4803edd

Please sign in to comment.