Why does iotop cause python crash with error as "IOError [Errno 32] Broken pipe" ?

Solution Verified - Updated -

Issue

  • iotop is crashing while use with pipe
$ sudo iotop -qqqb -n 1 |head -2
    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]
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
  • However it works fine when use as below
[root@test 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

Environment

  • Red Hat Enterprise Linux 6.6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content