Bug 1290691 - iotop crash, OSError: Netlink error: No such file or directory (2)
Summary: iotop crash, OSError: Netlink error: No such file or directory (2)
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: iotop
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Adel Gadllah
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-11 08:12 UTC by Chris Murphy
Modified: 2016-12-20 16:54 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-12-20 16:54:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
strace iotop (170.68 KB, text/plain)
2015-12-11 08:14 UTC, Chris Murphy
no flags Details

Description Chris Murphy 2015-12-11 08:12:01 UTC
Description of problem:

When running iotop in a privileged docker container, it crashes.


Version-Release number of selected component (if applicable):
docker-1.9.1-2.git78bc3ea.fc23.x86_64
iotop-0.6-6.fc23.noarch


How reproducible:
Always


Steps to Reproduce:
1. Fedora Atomic 23.29
2. docker pull fedora
3. docker run -it fedora /bin/bash
4. dnf install iotop hdparm smartmontools strace
5. docker commit <id> fedoradiskutils
6. exit
7. docker run --privileged=true -it fedoradiskutils /bin/bash
8. iotop

Actual results:

[root@34404614e573 /]# iotop
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 17, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 631, in main
    main_loop()
  File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 621, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 508, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib64/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 498, in run_iotop_window
    taskstats_connection = TaskStatsNetlink(options)
  File "/usr/lib/python2.7/site-packages/iotop/data.py", line 137, in __init__
    self.family_id = controller.get_family_id('TASKSTATS')
  File "/usr/lib/python2.7/site-packages/iotop/genetlink.py", line 69, in get_family_id
    m = GeNlMessage.recv(self.conn)
  File "/usr/lib/python2.7/site-packages/iotop/genetlink.py", line 51, in recv
    msg = conn.recv()
  File "/usr/lib/python2.7/site-packages/iotop/netlink.py", line 229, in recv
    raise err
OSError: Netlink error: No such file or directory (2)
[root@34404614e573 /]# 



Expected results:

Should work. hdparm -I <dev> works, as does smartctl -a both of which need more hardware access than iotop.


Additional info:

Comment 1 Chris Murphy 2015-12-11 08:14:06 UTC
Created attachment 1104593 [details]
strace iotop

Comment 2 Daniel Walsh 2015-12-11 14:59:04 UTC
This is probably because something in a container namespace is missing that the tool expects to see.

You might want to try to turn off a couple of the namespaces.  Candidates would be

--net=host 
and/or
--pid=host

Comment 3 Daniel Walsh 2015-12-11 15:00:39 UTC
This is definitely not a bug in docker. might be a bug in iotop. For some of the device checking you might want to run your containers with the hosts /dev mounted into the container.

docker run -v /dev:/dev --privileged ...

Comment 4 Chris Murphy 2015-12-11 17:42:04 UTC
Adding --net=host alone solves this. Other options alone result in the same traceback. Normal/expected?

Comment 5 Chris Murphy 2015-12-12 20:59:59 UTC
I spoke too soon. While --net=host avoids the crash, iotop doesn't list any processes. I'm not finding a combination of things that permits that.

Comment 6 Chris Murphy 2015-12-12 21:28:10 UTC
(In reply to Daniel Walsh from comment #3)

> docker run -v /dev:/dev --privileged ...

Do you mean literally '-v /dev:/dev' or the actual block devices being monitored? Because when I do this:

[root@f23a ~]# docker run --net=host -v /dev:/dev --privileged=true -it fedext /usr/sbin/iotop -d3

I can no longer remotely ssh into the f23a host that command was run on. Instead I get this from the client:

[chris@f23m ~]$ ssh chris.0.15
PTY allocation request failed on channel 0

Restarting sshd and docker, do nothing. I have to reboot to regain remote logins. If I use '-v /dev/sda:/dev/sda' the login breakage doesn't happen, but still no listed processes that are doing IO.

Comment 7 Chris Murphy 2015-12-12 21:43:35 UTC
no processes producing IO are listed when run in (privileged) docker container
https://bugzilla.redhat.com/show_bug.cgi?id=1291020

Comment 8 Daniel Walsh 2015-12-14 17:27:32 UTC
I am reassigning this to IOTOP to see if they have any insights.

If -v/dev/sda:/dev/sda works that is fine, also.  I think iotop is getting blocked by one or more of the namespaces.  Did you try with the --pid=host?

Comment 9 Chris Murphy 2015-12-14 18:06:45 UTC
(In reply to Daniel Walsh from comment #8)
> I am reassigning this to IOTOP to see if they have any insights.
> 
> If -v/dev/sda:/dev/sda works that is fine, also.

-v /dev:/dev actually breaks the ability to remote login to the host and I have to reboot. If that's a bug, I'll start a new one.

-v /dev/sda:/dev/sda doesn't break the host, but also doesn't make a difference in iotop's behavior. It still doesn't show any processes utilizing IO (except itself).

>  I think iotop is getting
> blocked by one or more of the namespaces.  Did you try with the --pid=host?

Yes. No change in behavior.

Comment 10 Daniel Walsh 2015-12-14 20:45:00 UTC
Does 

docker run -v /dev/sda:/dev/sda --privileged --net=host --pid=host ...

Work?

This tool looks like it is examining the host network and perhaps processes based on this device.

Comment 11 Chris Murphy 2015-12-14 21:53:43 UTC
Yes that does work. 

I suspect non-deterministic results though because now even without -v, and just --net=host --pid=host --privileged it also works which I had tried previously (albeit that was a different atomic tree version so kernel, docker, most things were different versions). I've got one other instance of a docker command affecting the behavior of the host (breaking ssh logins) until the next reboot. Between that and user error, the testing is challenging.

Comment 12 Chris Murphy 2015-12-16 06:11:32 UTC
reboot

# docker run --net=host --pid=host --privileged -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged -v /dev/sda:/dev/sda -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged=true -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged=true -v /dev/sda:/dev/sda -it fedext iotop -d3 -o

None of those crash, but none show all processes.

# docker run --net=host --pid=host -v /dev/sda:/dev/sda --privileged=true -it fedext /usr/sbin/iotop -d3
This one shows all processes. Why? Only the order of -v and --privileged differs.

# docker run --net=host --pid=host --privileged=true -it fedext iotop -d3
So does this! Now I don't even need -v?

# docker run --net=host --pid=host --privileged -it fedext iotop -d3
And now this works!!! This is the same first command that didn't work. If I reboot, this command no longer works (only iotop itself is shown as a process).

Again, none of these crash.

Comment 13 Daniel Walsh 2015-12-17 13:58:31 UTC
I have no idea,  the order of option handling should have no effect, they are all bundled up and sent to the docker daemon in the same bundle.   Their might be some changes being made to the kernel with each run then end up allowing the final docker run to work. 

For the most part the only thing that is shared between all of these containers is the kernel.  But I think we need people who know what iotop is doing to figure out what is happening.

Comment 14 Daniel Walsh 2016-01-06 20:46:41 UTC
ANy input from the IOTop guys?

Comment 15 Fedora End Of Life 2016-11-24 14:09:29 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Fedora End Of Life 2016-12-20 16:54:58 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.