google / novm

Experimental KVM-based VMM for containers, written in Go.
Apache License 2.0
1.68k stars 123 forks source link

Exception IOError: (9, 'Bad file descriptor') #32

Closed pwaller closed 9 years ago

pwaller commented 9 years ago

go 1.3.3 linux/amd64 python 2.7.8.

On exit, novm create spits out lots of errors.

$ novm create --name test --nofork --terminal --com1 --nic tapname=pw-tap,ip=192.168.32.5/24
[... snip ...]
Exception IOError: (9, 'Bad file descriptor') in <bound method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w' at 0x7fc81c4a8d20>> ignored
close failed in file object destructor:
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
IOErrorclose failed in file object destructor:
IOError: [Errno 9] Bad file descriptor: 
[Errno 9] Bad file descriptor
close failed in file object destructor:
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
IOError: [Errno 9] Bad file descriptor
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
pwaller commented 9 years ago

Apologies, the original post missed out some details. I've edited it to add the command run and a description of the bug.

pwaller commented 9 years ago

More details that I neglected to mention.

I was trying to run novm as a user. I now think this error is likely happening because dnsmasq is failing and its stdin/stdout/stderr are set to PIPEs which are never used:

https://github.com/google/novm/blob/master/novm/net.py#L188-L190

It may be desirable to see if dnsmasq exits, and if so, show some sort of warning/error.

pwaller commented 9 years ago

Hm, I take it back. It happens even if I'm not using dnsmasq.

It always seems to be fd number 9 when it happens. Here's a strace -e open |& grep 9 without -f.

open("/usr/lib/python2.7/_weakrefset.pyc", O_RDONLY) = 9
open("/usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so", O_RDONLY|O_CLOEXEC) = 9
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 9
open("/usr/lib/x86_64-linux-gnu/libffi.so.6", O_RDONLY|O_CLOEXEC) = 9
open("/usr/lib/python2.7/ctypes/_endian.pyc", O_RDONLY) = 9
open("/usr/lib/python2.7/base64.pyc", O_RDONLY) = 9
open("/usr/lib/python2.7/httplib.pyc", O_RDONLY) = 9
open("/usr/lib/python2.7/socket.py", O_RDONLY) = 9
open("/usr/lib/python2.7/urlparse.py", O_RDONLY) = 9
open("/usr/lib/python2.7/mimetools.py", O_RDONLY) = 9
open("/usr/lib/python2.7/ssl.py", O_RDONLY) = 9
open("/usr/lib/python2.7/bisect.pyc", O_RDONLY) = 9
open("/usr/lib/python2.7/urllib.pyc", O_RDONLY) = 9
open("./novm/device.pyc", O_RDONLY)     = 9
open("/usr/lib/python2.7/uuid.py", O_RDONLY) = 9
open("./novm/state.py", O_RDONLY)       = 9
open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 9
open("/home/pwaller/.novm/instances/2797.json", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 9
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 9
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 9
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 9
open("/proc/sys/net/core/somaxconn", O_RDONLY|O_CLOEXEC) = 9
open("/dev/kvm", O_RDWR|O_CLOEXEC)      = 9
open("/home/pwaller/.novm/kernels/01d04baaba3797b15c4cfc90e1afee0ec7f472c4/setup", O_RDONLY|O_CLOEXEC) = 9
open("/home/pwaller/.novm/kernels/01d04baaba3797b15c4cfc90e1afee0ec7f472c4/vmlinux", O_RDONLY|O_CLOEXEC) = 9
open("/home/pwaller/.novm/kernels/01d04baaba3797b15c4cfc90e1afee0ec7f472c4/initrd", O_RDONLY|O_CLOEXEC) = 9
open("/home/pwaller/.novm/kernels/01d04baaba3797b15c4cfc90e1afee0ec7f472c4/sysmap", O_RDONLY|O_CLOEXEC) = 9
pwaller commented 9 years ago

(the strace was not taken on an occasion when the error actually occurred).

pwaller commented 9 years ago

Tidying up my personal issues list, so closing this. Please create a new issue if you're still interested in tracking it.