RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1271519 - Error message "Unable to connect to the graphic server 127.0.0.1:xxxx" pops up
Summary: Error message "Unable to connect to the graphic server 127.0.0.1:xxxx" pops up
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-viewer
Version: 7.2
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: 7.3
Assignee: Virt Viewer Maint
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-14 08:17 UTC by Xiaodai Wang
Modified: 2016-11-04 01:11 UTC (History)
11 users (show)

Fixed In Version: virt-viewer-2.0-7.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 01:11:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
error message box (178.11 KB, image/png)
2015-10-14 08:17 UTC, Xiaodai Wang
no flags Details
virt-viewer connect to guest successfully (34.04 KB, text/plain)
2015-10-14 08:18 UTC, Xiaodai Wang
no flags Details
virt-vewer connect to guest failure (12.47 KB, text/plain)
2015-10-14 08:19 UTC, Xiaodai Wang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2229 0 normal SHIPPED_LIVE virt-viewer, libgovirt, spice-gtk, and usbredir bug fix and enhancement update 2016-11-03 13:26:58 UTC

Description Xiaodai Wang 2015-10-14 08:17:29 UTC
Created attachment 1082727 [details]
error message box

Description of problem:
Error message "Unable to connect to the graphic server 127.0.0.1:xxxx" pops up.

Version-Release number of selected component (if applicable):
virt-viewer-2.0-6.el7.x86_64
libvirt-1.2.17-13.el7.x86_64

How reproducible:
80%

Steps to Reproduce:
1. Use virt-viewer connect to a shutdown guest.
# G_MESSAGES_DEBUG=all virt-viewer rhel7.2-0924 --wait

2. Stop libvirtd service on host.
# service libvirtd stop

3. Start libvirtd service on host again.
# service libvirtd start
4. Start the guest.

Actual results:
Error message "Unable to connect to the graphic server 127.0.0.1:xxxx" pops up.

Expected results:
virt-viewer should connect to the guest correctly.

Additional info:
I attached the debug logs for both success and failure.

Comment 1 Xiaodai Wang 2015-10-14 08:18:56 UTC
Created attachment 1082729 [details]
virt-viewer connect to guest successfully

Comment 2 Xiaodai Wang 2015-10-14 08:19:32 UTC
Created attachment 1082730 [details]
virt-vewer connect to guest failure

Comment 4 Jonathon Jongsma 2015-10-14 16:18:51 UTC
The fact that you have these warnings even on the successful run makes me think that you are using a non-standard configuration of some sort:

** (virt-viewer:4874): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-3yGBLPcl8U: Connection refused

(virt-viewer:5058): virt-viewer-DEBUG: Error: Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': No such file or directory



I have not been able to reproduce the failure here, and I don't see any of those warnings above. Can you give a little more information on your setup?

Is the client running on the same machine as the host? If not, what OS is the host?

Comment 5 Xiaodai Wang 2015-10-15 02:31:36 UTC
Yes, the client is running on the same machine as the host. 
It's easy to meet this problem at the first time. And then you redo the same operation, it's hard to reproduce it. I tried about 8~12 times to reproduce it again. So you can try it many times.

Comment 6 Christophe Fergeau 2015-10-15 08:40:09 UTC
Is this being run as root?

Comment 7 Christophe Fergeau 2015-10-15 09:05:44 UTC
Actually I can reproduce this on a 7.2 system. Building virt-viewer from 7.2 and running it on a fedora box leads to a different kind of failure for what it's worth (repeated "cannot connect to libvirt socket" messages during libvirtd downtime).

Comment 8 Xiaodai Wang 2015-10-15 09:53:04 UTC
(In reply to Christophe Fergeau from comment #6)
> Is this being run as root?

yes

Comment 9 Christophe Fergeau 2015-10-15 13:24:33 UTC
Some experiments I've run


This triggers the bug:
$ virsh destroy $domain_name
$ virt-viewer $domain_name --wait
$ systemctl stop libvirtd.service && systemctl start libvirtd.service
$
$ virsh start $domain_name


This does not trigger the bug:
$ virsh destroy $domain_name
$ virt-viewer $domain_name --wait
$ systemctl stop libvirtd.service && systemctl start libvirtd.service
$
$ virsh start $other_domain && virsh destroy $other_domain && sleep 1 && virsh start $domain_name


This triggers the bug:
$ virsh destroy $domain_name
$ virt-viewer $domain_name --wait
$ systemctl stop libvirtd.service && systemctl start libvirtd.service
$
$ sleep 10 && virsh start $domain_name


Adding a 1 second g_usleep in virt_viewer_session_spice_open_host() right before the spice_session_connect() call also makes the bug go away in all cases.


Another thing to have in mind is that after a libvirt restart, virt-viewer does some polling to detect domain startup and connect to it rather than use libvirt domain events. See virt_viewer_start_reconnect_poll() and virt_viewer_connect_timer() and VirtViewer::domain_event. If I force domain_event to always be -1 in virt_viewer_connect(), I can sometimes reproduce this issue without a libvirtd restart. Why it's more reliably reproducible without a libvirtd restart, I don't know.

My current theory is that by polling libvirt domain, we get connection information before the domain is fully ready (SPICE ports not initialized), and thus the connection fails. Maybe always using libvirt events instead of falling back to polling would fix this bug.

Comment 10 Christophe Fergeau 2015-10-15 15:44:00 UTC
https://www.redhat.com/archives/virt-tools-list/2015-October/msg00043.html avoids this bug: it makes sure we don't keep polling when connecting to a recent (0.8 or newer) libvirtd.
As only connections to VM through the polling code have this bug (I think), this patch will prevent the buggy situation from occurring.

Comment 12 Fabiano Fidêncio 2016-03-15 12:26:45 UTC
Here is the relevant commit for virt-viewer:
c1e72c1be177544e5a718303dcb88412568f46d9

Comment 14 Xiaodai Wang 2016-04-14 09:22:29 UTC
I can reproduce it with versions:
virt-viewer-2.0-6.el7.x86_64
libvirt-1.2.17-13.el7.x86_64

And then only update virt-viewer to virt-viewer-2.0-7.el7.x86_64 and tried it several times again. It doesn't occur.

At last updated libvirt to latest version libvirt-1.3.3-1.el7.x86_64 and tried it several times. I didn't meet this issue.

So move the bug from ON_QA to VERIFIED.

Comment 16 errata-xmlrpc 2016-11-04 01:11:47 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


Note You need to log in before you can comment on or make changes to this bug.