Bug 1301863

Summary: virt-manager crashes after clicking the login button
Product: Red Hat Enterprise Linux 7 Reporter: Xiaodai Wang <xiaodwan>
Component: spice-gtkAssignee: Default Assignee for SPICE Bugs <rh-spice-bugs>
Status: CLOSED ERRATA QA Contact: SPICE QE bug list <spice-qe-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: cfergeau, juzhou, lmiksik, mxie, mzhan, pgrunt, phrdina, rbalakri, rduda, tlavigne, tpelka, tzheng, victortoso
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: spice-gtk-0.26-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 01:14:21 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
virt-manager --debug log
none
abrt log
none
SPICE_DEBUG=1 virt-manager --debug log
none
gdb backtrace log none

Description Xiaodai Wang 2016-01-26 08:38:29 UTC
Description of problem:
virt-manager crashes after clicking the loging button

Version-Release number of selected component (if applicable):
virt-manager-1.2.1-8.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. launch "virt-manager"
2. Open hardware details and click "display spice" device and Set a password for it.
3. Start the guest.
4. Check the "Save this password in your keyring" option and type the password.
5. Close the vm window and double click the vm to open the vm window again, check the password is remembered but the "Save this password in your keyring" option is not checked.
6. Clear the password string and click login, nothing happenes.
7. Close the vm window and open it again, type the correct password and then click login button.
8. Repeat step6 and step7 several times, after about 5 times, the virt-manager crashes. 



Actual results:
bug1:
After step 5, the "Save this password in your keyring" option is unchecked unexpectedly.
bug2:
After step8, virt-manager crashes.


Expected results:
After step5, the "Save this password in your keyring" option should still be checked. 
After step8, virt-manager should not crash.

Additional info:
Please see virt-manager --debug log and abrt log in attachments.

Comment 1 Xiaodai Wang 2016-01-26 08:39:14 UTC
Created attachment 1118386 [details]
virt-manager --debug log

Comment 2 Xiaodai Wang 2016-01-26 08:39:50 UTC
Created attachment 1118387 [details]
abrt log

Comment 4 Pavel Hrdina 2016-01-26 11:45:11 UTC
Hi, so at first, please file one bug for each issue, never add more than one issue into a single bug.

The first issue is probably virt-manager bug and I'll look into it.

The second issue is a crash where coredump is produced.  Virt-manager itself cannot crash as it's pure python code, there could be only unhandled exception related to virt-manager code.  If coredump is produced by running virt-manager, the package to blame is python or any other module used by virt-manager, which can be deducted from the backtrace.  In this case it's probably python or spice.

Comment 5 Xiaodai Wang 2016-01-27 02:34:09 UTC
(In reply to Pavel Hrdina from comment #4)
> Hi, so at first, please file one bug for each issue, never add more than one
> issue into a single bug.
> 
> The first issue is probably virt-manager bug and I'll look into it.

I filed bug 1302175 for the first issue.

Bug 1302175 - The "Save this password in your keyring" option is unchecked unexpectedly

> 
> The second issue is a crash where coredump is produced.  Virt-manager itself
> cannot crash as it's pure python code, there could be only unhandled
> exception related to virt-manager code.  If coredump is produced by running
> virt-manager, the package to blame is python or any other module used by
> virt-manager, which can be deducted from the backtrace.  In this case it's
> probably python or spice.

Comment 6 Pavel Hrdina 2016-01-27 11:39:19 UTC
Based on comment 4 moving to spice-gtk for further investigation.

Comment 7 Christophe Fergeau 2016-01-27 11:49:30 UTC
These uncaught exceptions in the log do not look good:
[Tue, 26 Jan 2016 13:53:57 virt-manager 5167] DEBUG (cli:241) Uncaught exception:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/console.py", line 691, in _viewer_add_display
    self._refresh_resizeguest_from_settings()
  File "/usr/share/virt-manager/virtManager/console.py", line 351, in _refresh_resizeguest_from_settings
    elif not self._viewer.console_has_agent():
  File "/usr/share/virt-manager/virtManager/viewers.py", line 249, in console_has_agent
    return self._has_agent()
  File "/usr/share/virt-manager/virtManager/viewers.py", line 658, in _has_agent
    return self._main_channel.get_property("agent-connected")
TypeError: object at 0x3893d70 of type MainChannel is not initialized

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/console.py", line 691, in _viewer_add_display
    self._refresh_resizeguest_from_settings()
  File "/usr/share/virt-manager/virtManager/console.py", line 351, in _refresh_resizeguest_from_settings
    elif not self._viewer.console_has_agent():
  File "/usr/share/virt-manager/virtManager/viewers.py", line 249, in console_has_agent
    return self._has_agent()
  File "/usr/share/virt-manager/virtManager/viewers.py", line 658, in _has_agent
    return self._main_channel.get_property("agent-connected")
TypeError: object at 0x3893d70 of type MainChannel is not initialized


If virt-manager is misusing spice-gtk C API (for example by passing it uninitialized memory), then it may crash.
I don't know how to get a C or python backtrace for the code which caused the segmentation fault out of the abrt log. Could you add one of these to the bug?

Comment 8 Pavel Hrdina 2016-01-27 11:55:16 UTC
The thing is, that virt-manager uses only python code, which means it uses python binding of spice-gtk C API.  There is no such thing like uninitialized memory in python.  Yes, we should probably do a better work in handling exceptions and I'll look into it, still, it shouldn't crash.

Comment 9 Christophe Fergeau 2016-01-27 12:03:58 UTC
If you misuse spice-gtk API from Python, I'm fairly sure you can get it to crash. This bug has nothing to rule that out, and has some worrying python assertions which could hint that. At the same time, it's missing a C backtrace, or anything that could give us info about what's going on on the spice-gtk side (SPICE_DEBUG=1 virt-manager -d might help too)

Comment 10 Xiaodai Wang 2016-01-27 12:49:43 UTC
Created attachment 1118774 [details]
SPICE_DEBUG=1 virt-manager --debug log

Comment 11 Christophe Fergeau 2016-01-27 16:51:13 UTC
Could you extract a backtrace from the coredump you have, or attach gdb to the running running virt-manager process, trigger a crash and get the backtrace from there?

Comment 12 Xiaodai Wang 2016-01-28 08:42:27 UTC
Created attachment 1119072 [details]
gdb backtrace log

Comment 13 Christophe Fergeau 2016-01-28 09:59:56 UTC
The C backtrace at the time of the crash matches the python backtrace mentioned in comment #7:


/usr/share/virt-manager/virtManager/viewers.py, line 658, in _has_agent
/usr/share/virt-manager/virtManager/viewers.py, line 249, in console_has_agent
/usr/share/virt-manager/virtManager/console.py, line 351, in _refresh_resizeguest_from_settings
/usr/share/virt-manager/virtManager/console.py, line 691, in _viewer_add_display

Comment 14 Pavel Grunt 2016-03-04 14:24:11 UTC
fixed upstream by commits:
 ff25f3eacb1776a754147cd57c76882392382030
 6b475802d78f2a4f2110738cb360b496dc85336c

Comment 20 errata-xmlrpc 2016-11-04 01:14:21 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.

https://rhn.redhat.com/errata/RHBA-2016-2229.html