Bug 819436

Summary: "Segmentation fault (core dumped)" displayed in terminal when a virt-viewer
Product: Red Hat Enterprise Linux 6 Reporter: Geyang Kong <gkong>
Component: virt-viewerAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: ajia, bsarathy, cfergeau, dallan, dblechte, dyasny, mjenner, mzhan, rwu, syeghiay, yupzhang, zpeng
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-viewer-0.5.2-8.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 12:12:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Debug information with --debug option
none
Patch for the issue. none

Description Geyang Kong 2012-05-07 09:03:21 UTC
Created attachment 582569 [details]
Debug information with --debug option

Description of problem:
  "Segmentation fault (core dumped)" displayed in terminal when a virt-viewer form being closed.

Version-Release number of selected component (if applicable):
virt-viewer-0.5.2-7.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Make sure there is a running guest.
2. Run #virt-viewer $guestname.
3. Close the virt-viewer form.

Actual results:
1. After step 3. Following words showed in terminal:
   Segmentation fault (core dumped)

Expected results:
1. Form can be closed without any message.

Additional info:
1. This issue cannot be reproduced by virt-viewer-0.5.2-6.el6.x86_64

Comment 4 Alex Jia 2012-05-08 06:58:42 UTC
Hello Daniel, I tried to resolve this issue, unfortunately, I can't run compiled virt-viewer and got the following debug information:

 Opening connection to libvirt with URI <null>
(virt-viewer:656): virt-viewer-DEBUG: Add handle 14 1 0x9fc1b0
(virt-viewer:656): virt-viewer-DEBUG: Add timeout 0x9fbc50 -1 0x7f61c8f43750 0x9fb690 1
(virt-viewer:656): virt-viewer-DEBUG: notebook show status 0x995140
(virt-viewer:656): virt-viewer-DEBUG: notebook show status 0x995140
(virt-viewer:656): virt-viewer-DEBUG: Guest vr-rhel6-x86_64-kvm is running, determining display

Guest vr-rhel6-x86_64-kvm is running, determining display
(virt-viewer:656): virt-viewer-DEBUG: Set connect info: (null),(null),(null),-1,(null),(null),(null),0
(virt-viewer:656): virt-viewer-DEBUG: Guest vr-rhel6-x86_64-kvm has unsupported vnc display type

Guest vr-rhel6-x86_64-kvm has unsupported vnc display type
(virt-viewer:656): virt-viewer-DEBUG: Dispatch handler 14 1 0x9fc1b0
(virt-viewer:656): virt-viewer-DEBUG: Update timeout 0x9fbc50 1 0
(virt-viewer:656): virt-viewer-DEBUG: Dispatch timeout 0x9fbc50 0x7f61c8f43750 1 0x9fb690
(virt-viewer:656): virt-viewer-DEBUG: Update timeout 0x9fbc50 1 -1
(virt-viewer:656): virt-viewer-DEBUG: Failed to activate viewer
(virt-viewer:656): virt-viewer-DEBUG: Remove handle 1 14
(virt-viewer:656): virt-viewer-DEBUG: Remove timeout 0x9fbc50 1
(virt-viewer:656): virt-viewer-DEBUG: Disposing window 0x996010

BTW. it's fine if I installed a virt-vierwer-0.5.2-7.el6.x86_64 rpm package on my host.

So I did a fixed from codes POV without actual test.

Comment 5 Alex Jia 2012-05-08 06:59:28 UTC
Created attachment 582873 [details]
Patch for the issue.

Comment 6 Daniel Berrangé 2012-05-08 09:00:35 UTC
@alex: that patch is fixing the wrong place - I think you mixed up line numbers between upstream & RHEL sources. The self->priv->windows variable is fine, it is 'vwin' variable that is NULL.

I have a patch prepared that I am currently testing.

Comment 7 Alex Jia 2012-05-08 09:31:45 UTC
(In reply to comment #6)
> @alex: that patch is fixing the wrong place - I think you mixed up line numbers
> between upstream & RHEL sources. The self->priv->windows variable is fine, it
You're right.
> is 'vwin' variable that is NULL.
> 
> I have a patch prepared that I am currently testing.
Good to know this.

In addition, I don't know why I can't run compiled virt-viewer on my host and got some error "Guest vr-rhel6-x86_64-kvm has unsupported vnc display type" like Comment 4, as I said, I should haven't miss any dependent rpm installation like gtk2, spice-gtk, etc, because it's okay if I directly install virt-vierwer-0.5.2-7.el6.x86_64 rpm. the issue always confuses me today, thanks.

Comment 8 Daniel Berrangé 2012-05-08 09:54:56 UTC
> like Comment 4, as I said, I should haven't miss any dependent rpm installation
> like gtk2, spice-gtk, etc, because it's okay if I directly install
> virt-vierwer-0.5.2-7.el6.x86_64 rpm. the issue always confuses me today,
> thanks.

Double check that you have  gtk-vnc-devel installed - also look at the summary which  configure prints out to confirm.

Comment 9 Alex Jia 2012-05-08 11:02:54 UTC
(In reply to comment #8)
> > like Comment 4, as I said, I should haven't miss any dependent rpm installation
> > like gtk2, spice-gtk, etc, because it's okay if I directly install
> > virt-vierwer-0.5.2-7.el6.x86_64 rpm. the issue always confuses me today,
> > thanks.
> 
> Double check that you have  gtk-vnc-devel installed - also look at the summary
> which  configure prints out to confirm.

Yeah, as you said, I haven't install gtk-vnc-devel, I met a new issue after intalling gtk-vnc-devel rpm:

# virt-viewer
No protocol specified
Cannot open display:
Run 'virt-viewer --help' to see a full list of available command line options

# virt-viewer --display=$DISPLAY
No protocol specified
Cannot open display: :0.0
Run 'virt-viewer --help' to see a full list of available command line options

Daniel, any suggestion for above issue.

BTW, in addition, I saw some compiling warning, of course, it hasn't any relationship with our issue: 

In file included from virt-viewer-session-spice.c:39:
gbinding.c: In function 'on_source_notify':
gbinding.c:381: warning: unused parameter 'gobject'
gbinding.c: In function 'on_target_notify':
gbinding.c:422: warning: unused parameter 'gobject'
gbinding.c: In function 'g_binding_init':
gbinding.c:709: warning: unused parameter 'binding'


Additional info:

configure: Configuration summary
configure: =====================
configure: 
configure:  Features:
configure: 
configure:    Plugin: no
configure:       Gtk: 2.0
configure: 
configure:  Libraries:
configure: 
configure:        GLIB2: -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -pthread -Wl,--export-dynamic -lgthread-2.0 -lrt -lgmodule-2.0 -lglib-2.0  
configure: 
configure:          GTK: -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
configure: 
configure:      GTK_VNC: -I/usr/include/gtk-vnc-1.0 -I/usr/include/gvnc-1.0 -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -lgtk-vnc-1.0 -lgvnc-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
configure: 
configure:    SPICE_GTK: -I/usr/include/spice-client-gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/spice-client-glib-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/spice-1   -lspice-client-gtk-2.0 -lgtk-x11-2.0 -lspice-client-glib-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
configure: 
configure:      LIBXML2: -I/usr/include/libxml2   -lxml2  
configure: 
configure:      LIBVIRT:   -lvirt -ldl

Comment 10 Daniel Berrangé 2012-05-08 13:56:27 UTC
commit d0de667ec276eaca115a00b0c7b0010488459ae9
Author: Daniel P. Berrange <berrange>
Date:   Tue May 8 14:39:44 2012 +0100

    Avoid race condition when disposing of app
    
    When disposing of the VirtViewerApp, we free the hash table
    containing the windows. This causes each window to be freed,
    which in turn causes the visibility callback to be invoked.
    This can then get NULL pointers from the self->priv->windows
    usage.
    
    Blank out priv->windows before unrefing the hashs and add
    a check to ensure priv->windows is non-NULL.

Comment 12 Geyang Kong 2012-05-09 03:03:28 UTC
Verified pass on the following build
virt-viewer-0.5.2-8.el6.x86_64

Steps:
Same as description

Actual result:
1. After closing virt-viewer form, nothing will display in terminal

Comment 13 Geyang Kong 2012-05-09 03:30:41 UTC
According to Comment 12, change this bug to VERIFIED.

Comment 15 errata-xmlrpc 2012-06-20 12:12:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0772.html