[libvirt] [PATCH] Bugfix: Check stdoutWatch before removing the handler.

--- tools/console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/console.c b/tools/console.c index 11087e5..171ebc9 100644 --- a/tools/console.c +++ b/tools/console.c @@ -95,7 +95,7 @@ virConsoleShutdown(virConsolePtr con) virStreamFree(con->st); if (con->stdinWatch != -1) virEventRemoveHandle(con->stdinWatch); - if (con->stdinWatch != -1) + if (con->stdoutWatch != -1) virEventRemoveHandle(con->stdoutWatch); con->stdinWatch = -1; con->stdoutWatch = -1; -- 1.7.4.1

On Wed, Aug 10, 2011 at 05:03:23PM +0200, Juerg Haefliger wrote:
--- tools/console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/console.c b/tools/console.c index 11087e5..171ebc9 100644 --- a/tools/console.c +++ b/tools/console.c @@ -95,7 +95,7 @@ virConsoleShutdown(virConsolePtr con) virStreamFree(con->st); if (con->stdinWatch != -1) virEventRemoveHandle(con->stdinWatch); - if (con->stdinWatch != -1) + if (con->stdoutWatch != -1) virEventRemoveHandle(con->stdoutWatch); con->stdinWatch = -1; con->stdoutWatch = -1; -- 1.7.4.1
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
ACK Dave

On 08/10/2011 09:09 AM, Dave Allan wrote:
On Wed, Aug 10, 2011 at 05:03:23PM +0200, Juerg Haefliger wrote:
--- tools/console.c | 2 +-
- if (con->stdinWatch != -1) + if (con->stdoutWatch != -1) virEventRemoveHandle(con->stdoutWatch); con->stdinWatch = -1; con->stdoutWatch = -1; -- 1.7.4.1
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
ACK
Pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Hello, On Wednesday 10 August 2011 17:25:58 Eric Blake wrote:
On 08/10/2011 09:09 AM, Dave Allan wrote:
On Wed, Aug 10, 2011 at 05:03:23PM +0200, Juerg Haefliger wrote:
--- tools/console.c | 2 +-
- if (con->stdinWatch != -1) + if (con->stdoutWatch != -1)
Excellent, that fixes one anoying crash I also observed when automating my snapshot testing. While testing it I noticed the following behaviour: 1. Start virsh 2. Do "qemu-monitor-command $SOME_VM info\ chardev" to get the path of the pty used for the console → /dev/pts/Y 3. Execute "console $SOME_VM" from within the same virsh X≥2 times; terminate each console with ^]. 4. Run `lsof /dev/pts/Y' or 'lsof -p `pidof libvirtd`, which shows the pty to be opened X times. 5. Exit virsh and re-run the lsof-command: The pty is still opened. 6. Start virsh again: "0.8.4+the patch" hangs here and is not killable by SIGTERM, only SIGKILL; backtrace is attached. With 0.9.4 this seems to be fixed and is working, but: 7. Executing another "console $SOME_VM" delays for some amount of time and than opens the console. 8. Rerunning "lsof" again now shows only the pty to be opened once. Good. Can somebody else reproduce this? Is this normal? Sincerely Philipp Hahn -- Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/

Hello, On Thursday 11 August 2011 08:35:25 Philipp Hahn wrote:
While testing it I noticed the following behaviour: 1. Start virsh 2. Do "qemu-monitor-command $SOME_VM info\ chardev" to get the path of the pty used for the console → /dev/pts/Y 3. Execute "console $SOME_VM" from within the same virsh X≥2 times; terminate each console with ^]. 4. Run `lsof /dev/pts/Y' or 'lsof -p `pidof libvirtd`, which shows the pty to be opened X times. 5. Exit virsh and re-run the lsof-command: The pty is still opened. 6. Start virsh again: "0.8.4+the patch" hangs here and is not killable by SIGTERM, only SIGKILL; backtrace is attached. With 0.9.4 this seems to be fixed and is working, but:
That was fixed with 88416593e19d56433662b801d6e72ba182024fd9 for 0.9.0.
7. Executing another "console $SOME_VM" delays for some amount of time and than opens the console.
This one still puzzels me and I'd like to know if this is normal.
8. Rerunning "lsof" again now shows only the pty to be opened once. Good.
Sincerely Philipp Hahn -- Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/

On Thu, Aug 11, 2011 at 04:06:59PM +0200, Philipp Hahn wrote:
Hello,
On Thursday 11 August 2011 08:35:25 Philipp Hahn wrote:
While testing it I noticed the following behaviour: 1. Start virsh 2. Do "qemu-monitor-command $SOME_VM info\ chardev" to get the path of the pty used for the console → /dev/pts/Y 3. Execute "console $SOME_VM" from within the same virsh X≥2 times; terminate each console with ^]. 4. Run `lsof /dev/pts/Y' or 'lsof -p `pidof libvirtd`, which shows the pty to be opened X times. 5. Exit virsh and re-run the lsof-command: The pty is still opened. 6. Start virsh again: "0.8.4+the patch" hangs here and is not killable by SIGTERM, only SIGKILL; backtrace is attached. With 0.9.4 this seems to be fixed and is working, but:
That was fixed with 88416593e19d56433662b801d6e72ba182024fd9 for 0.9.0.
7. Executing another "console $SOME_VM" delays for some amount of time and than opens the console.
This one still puzzels me and I'd like to know if this is normal.
I do not think that's normal. I do not see that exact behavior with the current HEAD (762101c7affbd32af18eccc07249c2684cbb84a2) but I do notice that connecting then reconnecting to the console in an interactive virsh session leads to garbled output consistent with multiple consoles being open. I filed: https://bugzilla.redhat.com/show_bug.cgi?id=730101 If you can reproduce tha, or see other weirdness in 0.9.4, please comment in the BZ or file a separate bug. Dave
8. Rerunning "lsof" again now shows only the pty to be opened once. Good.
Sincerely Philipp Hahn -- Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (4)
-
Dave Allan
-
Eric Blake
-
Juerg Haefliger
-
Philipp Hahn