Bug 1025706

Summary: virt-manager causes a python trace-back instead of handling the error when it cannot open display
Product: Red Hat Enterprise Linux 6 Reporter: Christos Triantafyllidis <ctrianta>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: ctrianta, dyuan, gscrivan, jbuchta, lcui, mkletzan, mzhan, pkoro, rbalakri, tzheng
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virt-manager-0.9.0-20.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 06:26:19 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
Replaces raise with print + sys.exit none

Description Christos Triantafyllidis 2013-11-01 10:58:55 UTC
Description of problem:
If when executed virt-manager via ssh there is no x-forwarding enabled virt-manager (as expected) fails to execute. Instead of handling this error it prints the python traceback:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 383, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 286, in main
    raise gtk_error
RuntimeError: could not open display

This causes abrt daemon to run (if it is configured) and that causes additional (unneeded) load / issues as it executes sosreport in the background.

Version-Release number of selected component (if applicable):
virt-manager-0.9.0-18.el6.x86_64

How reproducible:
Everytime

Steps to Reproduce:
1. Install virt-manager
2. Connect to that host via ssh without X forwarding
3. Execute virt-manager

Actual results:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 383, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 286, in main
    raise gtk_error
RuntimeError: could not open display

Expected results:
Any handling of the error that would print a normal user friendly error message i.e.:
"There is no display available to execute virt-manager. DISPLAY is not set."

Additional info:

Comment 1 Christos Triantafyllidis 2013-11-01 11:31:20 UTC
Created attachment 818257 [details]
Replaces raise with print + sys.exit

(Ugly) patch that workarounds the issue.

Simple replaces the raise with "print + sys.exit"

Comment 2 Giuseppe Scrivano 2013-11-01 11:54:37 UTC
I don't think virt-manager should try to intercept this error and try to guess the reason why it fails.  The "RuntimeError: could not open display" error message is raised by GTK and if it has to be improved, it should definitely be done there.

I am not sure we want to drop the stack-trace, I am personally inclined to keep it as it is, the stack-trace is very helpful when it comes to troubleshoot problems.


All graphical applications I have tried, are affected by this problem:

$ LANG=C DISPLAY= pidgin

(Pidgin:20168): Gdk-CRITICAL **: IA__gdk_display_get_name: assertion `GDK_IS_DISPLAY (display)' failed
Pidgin 2.10.7-3.fc19

** (Pidgin:20168): WARNING **: cannot open display: unset


$ LANG=C DISPLAY= firefox

(process:20169): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
Error: cannot open display: 


$ LANG=C DISPLAY= chromium-browser

(chromium-browser:20185): Gtk-WARNING **: cannot open display: 


$ LANG=C DISPLAY= gimp
Cannot open display: 

Please reopen if you disagree with me.

Comment 4 Giuseppe Scrivano 2013-11-01 16:58:34 UTC
Cole just pushed a change that seems to have fixed this issue:

commit 395a20edd82f1072d23e80ecbb25dbeed9359304
Author: Cole Robinson <crobinso>
Date:   Fri Nov 1 09:44:14 2013 -0400

    virt-manager: Yet more fixes for DISPLAY unset error
    
    Since these days we have to import Gtk _after_ forking, _and_ Gtk
    doesn't raise a nice error for us, we need to postpone dropping stdio
    so the user has any chance of seeing the error. Also try to add an
    explicit error about DISPLAY again, since we don't get it from Gtk
    these days.


It has the side effect of dropping the python trace-back you had before.  Can you please confirm it?

Comment 5 hyao@redhat.com 2013-11-18 09:21:31 UTC
I can reproduce with 
#  rpm -qa virt-manager
virt-manager-0.9.0-19.el6.x86_64


# virt-manager
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 383, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 286, in main
    raise gtk_error
RuntimeError: could not open display

I'll try again once the new package available on rhel6.

Comment 8 Cui Lei 2014-05-05 03:26:59 UTC
I can reproduce this issue with virt-manager-0.9.0-19.el6.x86_64 like comment5.

Verify this issue with:
virt-manager-0.9.0-20.el6.x86_64
python-virtinst-0.600.0-20.el6.noarch
libvirt-0.10.2-29.el6_5.7.x86_64

Steps:
1. From a remote host, Connect to that host via ssh without X forwarding
2. Execute virt-manager

Results:
# virt-manager
Unable to initialize GTK: could not open display

virt-manager handle the error when it cannot open display, and python track-back did not display.

So change the status from 'QN_QA' to 'VERIFIED'
BTW, remove the needinfo as Christos needinfo himself, as a reporter, he should clear the bug and see the verify result.

Comment 9 errata-xmlrpc 2014-10-14 06:26:19 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-2014-1447.html