[Bug 1113911] [NEW] vm's with pty console hang on start, eat 100% cpu waiting for console input

Launchpad Bug Tracker 1113911 at bugs.launchpad.net
Thu Feb 28 20:57:05 UTC 2013


You have been subscribed to a public bug:

QEMU virtual machines with only a serial pty console will hang on start,
consuming 100% cpu, waiting for input from the console. This prevents
normal starting of virtual machines in a server environment.

Possibly related: https://bugs.launchpad.net/qemu/+bug/1047470

======== Software versions ========
Ubuntu 12.10 quantal
Ubuntu 3.5.0-23.35-generic 3.5.7.2
qemu 1.2.0+noroms-0ubuntu2.12.10.2
kvm 1:84+dfsg-0ubuntu16+1.2.0+noroms+0ubuntu2.12.10.2
linux-image-3.5.0-23-generic 3.5.0-23.35

======== Example libvirt config snippet ========
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>

======== strace ========
strace of kvm process during 100% cpu utilization shows the following repeating in a loop..........................
write(9, "\1\0\0\0\0\0\0\0", 8)         = 8
read(7, 0x7fffe7e1a5a0, 128)            = -1 EAGAIN (Resource temporarily unavailable)
write(9, "\1\0\0\0\0\0\0\0", 8)         = 8
timer_gettime(0x8, {it_interval={0, 0}, it_value={0, 0}}) = 0
timer_settime(0x8, 0, {it_interval={0, 0}, it_value={0, 9934393}}, NULL) = 0
timer_gettime(0x8, {it_interval={0, 0}, it_value={0, 9893037}}) = 0
timer_settime(0x8, 0, {it_interval={0, 0}, it_value={0, 1041537}}, NULL) = 0
timer_gettime(0x8, {it_interval={0, 0}, it_value={0, 997359}}) = 0
timer_settime(0x8, 0, {it_interval={0, 0}, it_value={0, 945520}}, NULL) = 0
futex(0x7f0545dd69c0, FUTEX_WAKE_PRIVATE, 1) = 1
select(17, [4 7 8 11 14 15 16], [], [], NULL) = 2 (in [4 8])
read(4, 0x7fffe7e196b0, 1)              = -1 EIO (Input/output error)
timer_gettime(0x8, {it_interval={0, 0}, it_value={0, 753905}}) = 0
timer_settime(0x8, 0, {it_interval={0, 0}, it_value={0, 705886}}, NULL) = 0
read(8, "\2\0\0\0\0\0\0\0", 512)        = 8
futex(0x7f0545dd69c0, FUTEX_WAKE_PRIVATE, 1) = 1
select(17, [7 8 11 14 15 16], [], [], NULL) = 1 (in [7])
read(7, "\16\0\0\0\0\0\0\0\376\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0"..., 128) = 128
rt_sigaction(SIGALRM, NULL, {0x7f05450ca800, ~[KILL STOP RTMIN RT_1], SA_RESTORER, 0x7f0540bcacb0}, 8) = 0

======== workaround ========
--- qemu-kvm-1.2.0+noroms/qemu-char.c.orig	2013-02-03 01:00:59.874031609 +0000
+++ qemu-kvm-1.2.0+noroms/qemu-char.c	2013-02-03 00:49:15.098213218 +0000
@@ -988,6 +988,7 @@
     char *pty_name = NULL;
 #define q_ptsname(x) ptsname(x)
 #endif
+    char bleh[1] = {'\0'};

     if (openpty(&master_fd, &slave_fd, pty_name, NULL, NULL) < 0) {
         return NULL;
@@ -997,6 +998,7 @@
     tcgetattr(slave_fd, &tty);
     cfmakeraw(&tty);
     tcsetattr(slave_fd, TCSAFLUSH, &tty);
+    write(slave_fd, bleh, 1);
     close(slave_fd);

     chr = g_malloc0(sizeof(CharDriverState));

** Affects: qemu-kvm (Ubuntu)
     Importance: High
         Status: Invalid

-- 
vm's with pty console hang on start, eat 100% cpu waiting for console input
https://bugs.launchpad.net/bugs/1113911
You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to qemu-kvm in Ubuntu.



More information about the Ubuntu-server-bugs mailing list