Bug 1330965

Summary: iotop causes python crash while using with pipe
Product: Red Hat Enterprise Linux 6 Reporter: Manish Saxena <msaxena>
Component: iotopAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6CC: cww, pchavan, psklenar, rpiddapa, tcerna
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: iotop-0.3.2-9.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 11:15:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
backported fix none

Description Manish Saxena 2016-04-27 11:29:05 UTC
Description of problem:

[root@vm232 etc]# iotop -qqqb -n 1  | tail -5
 4603 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
 4604 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
 4605 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
 4606 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
 4607 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
[root@vm232 etc]# iotop -qqqb -n 1  | head -5
 4608 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
    main()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 559, in main
    main_loop()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 549, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 445, in run_iotop
    return run_iotop_window(None, options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 440, in run_iotop_window
    ui.run()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 120, in run
    self.process_list.duration)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 399, in refresh_display
    print l
IOError: [Errno 32] Broken pipe
[root@vm232 etc]# rpm -qa | grep iotop
iotop-0.3.2-7.el6.noarch
[root@vm232 etc]# 
[root@vm232 etc]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.7 (Santiago)
[root@vm232 etc]#

Version-Release number of selected component (if applicable):

iotop-0.3.2-7.el6.noarch

How reproducible:
Everytime

Steps to Reproduce:
# iotop -qqqb -n 1  | head -5  

Actual results:

Python traceback failed 

[root@vm232 etc]# iotop -qqqb -n 1  | head -5
 4608 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % console-kit-daemon --no-daemon
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
    main()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 559, in main
    main_loop()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 549, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 445, in run_iotop
    return run_iotop_window(None, options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 440, in run_iotop_window
    ui.run()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 120, in run
    self.process_list.duration)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 399, in refresh_display
    print l
IOError: [Errno 32] Broken pipe

Expected results:
There should be no crash

Additional info:

Comment 3 Manish Saxena 2016-09-02 05:55:34 UTC
Reopening as customer need to fixed in RHEL 6.9

Comment 7 Michal Hlavinka 2016-11-02 22:23:11 UTC
Created attachment 1216792 [details]
backported fix

Comment 9 Tereza Cerna 2016-11-08 09:41:49 UTC
============================
Verified in:
    iotop-0.3.2-9.el6.noarch
PASS
============================

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.9 Beta (Santiago)

# rpm -q iotop
iotop-0.3.2-9.el6.noarch

# iotop -qqqb -n 1  | tail -5
 1478 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % mingetty /dev/tty5
 1479 be/3 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % udevd -d
 1480 be/3 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % udevd -d
  969 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % dhclient -H unused-4-151 -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
 1482 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % mingetty /dev/tty6

# iotop -qqqb -n 1  | head -5
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
 1027 be/3 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % auditd
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
    5 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [stopper/0]

============================
Reproduced in:
    iotop-0.3.2-7.el6.noarch
FAIL
============================

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.7 (Santiago)

# rpm -q iotop
iotop-0.3.2-7.el6.noarch
 
# iotop -qqqb -n 1  | tail -5  
 1507 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % mingetty /dev/tty5
 1509 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % mingetty /dev/tty6
 1617 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % bash -l
 1001 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % dhclient -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
 1520 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % sshd: root@pts/0
 
# iotop -qqqb -n 1  | head -5  
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
    5 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [stopper/0]
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
    main()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 559, in main
    main_loop()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 549, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 445, in run_iotop
    return run_iotop_window(None, options)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 440, in run_iotop_window
    ui.run()
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 120, in run
    self.process_list.duration)
  File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 400, in refresh_display
    sys.stdout.flush()
IOError: [Errno 32] Broken pipe

Comment 11 errata-xmlrpc 2017-03-21 11:15:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0726.html