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 1030487 - spice-server doesn't disconnect client tunnelled over ssh on VM shutdown
Summary: spice-server doesn't disconnect client tunnelled over ssh on VM shutdown
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-viewer
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Marc-Andre Lureau
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1075959 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-14 14:33 UTC by David Jaša
Modified: 2015-03-05 13:38 UTC (History)
11 users (show)

Fixed In Version: virt-viewer-0.6.0-8.el7
Doc Type: Bug Fix
Doc Text:
Cause: nc does not leave on server disconnect, and there doesn't seem to be any option to do that, leaving the client open, and a bunch of idle process Consequence: client doesn't disconnect when tunneled over ssh on VM shutdown Fix: Replace nc with socat, when socat is available Result: Clients tunneled over ssh can disconnect on VM shutdown
Clone Of:
Environment:
Last Closed: 2015-03-05 13:38:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0295 0 normal SHIPPED_LIVE virt-viewer bug fix and enhancement update 2015-03-05 17:33:00 UTC

Description David Jaša 2013-11-14 14:33:02 UTC
Description of problem:
spice-server doesn't disconnect client tunnelled over ssh on VM shutdown

Version-Release number of selected component (if applicable):
spice-server-0.12.4-3.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. fire up libvirt VM
2. connect to the VM over ssh: virt-viewer -c qemu+ssh://root@host/system vm_name
3. shut the VM down

Actual results:
client stays connected displaying last screen of the VM. A dozen of lines like this are printed to the console:
(virt-viewer:32748): GSpice-CRITICAL **: spice_inputs_key_release: assertion `SPICE_CHANNEL(channel)->priv->state != SPICE_CHANNEL_STATE_UNCONNECTED' failed

Expected results:
client disconnects

Additional info:
I tested 6.5 and 7.0 clients and servers:
client \ host  6.5            7.0
---------------------------------------------
6.5            disconnects    stays connected
7.0            disconnects    stays connected
--> assigning to 7.0 spice-server

Comment 1 Marc-Andre Lureau 2014-03-03 19:18:49 UTC
(In reply to David Jaša from comment #0)
> Description of problem:
> spice-server doesn't disconnect client tunnelled over ssh on VM shutdown
> 
> Version-Release number of selected component (if applicable):
> spice-server-0.12.4-3.el7.x86_64
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1. fire up libvirt VM
> 2. connect to the VM over ssh: virt-viewer -c qemu+ssh://root@host/system
> vm_name
> 3. shut the VM down

How do you shut down exactly? What is the guest OS? Can you verify qemu state when shuting down? Can you get qemu/spice-server log?

thanks

> 
> Actual results:
> client stays connected displaying last screen of the VM. A dozen of lines
> like this are printed to the console:
> (virt-viewer:32748): GSpice-CRITICAL **: spice_inputs_key_release: assertion
> `SPICE_CHANNEL(channel)->priv->state != SPICE_CHANNEL_STATE_UNCONNECTED'
> failed
> 
> Expected results:
> client disconnects
> 
> Additional info:
> I tested 6.5 and 7.0 clients and servers:
> client \ host  6.5            7.0
> ---------------------------------------------
> 6.5            disconnects    stays connected
> 7.0            disconnects    stays connected
> --> assigning to 7.0 spice-server

Comment 2 RHEL Program Management 2014-03-22 06:32:00 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 David Jaša 2014-04-16 10:22:30 UTC
(In reply to Marc-Andre Lureau from comment #1)
> ... 
> How do you shut down exactly?

from within the guest.

> What is the guest OS?

RHEL6 but that shouldn't matter

> Can you verify qemu state when shuting down? Can you get qemu/spice-server log?
> 

qemu process exits. There is a bunch of sshd processes left server-side that exit on client exit. Curiously enough, netstat doesn't show any connections on either side after the domain shuts down while client is still running. Qemu log shows nothing interesting (just what it says on any VM shutdown), "virt-viewer --debug" says around actual VM shutdown this:
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch handler 12 2 0x23086b0
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch handler 12 1 0x23086b0
(virt-viewer:22325): virt-viewer-DEBUG: Update timeout 0x20a1170 1 0
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch timeout 0x20a1170 0x35898e5ce0 1 0x2306f50
(virt-viewer:22325): virt-viewer-DEBUG: Update timeout 0x20a1170 1 -1
(virt-viewer:22325): virt-viewer-DEBUG: Got domain event 6 0
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch handler 12 1 0x23086b0
(virt-viewer:22325): virt-viewer-DEBUG: Update timeout 0x20a1170 1 0
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch timeout 0x20a1170 0x35898e5ce0 1 0x2306f50
(virt-viewer:22325): virt-viewer-DEBUG: Update timeout 0x20a1170 1 -1
(virt-viewer:22325): virt-viewer-DEBUG: Got domain event 5 0
(virt-viewer:22325): virt-viewer-DEBUG: Dispatch handler 12 1 0x23086b0

Comment 4 Marc-Andre Lureau 2014-04-16 10:30:25 UTC
Based on last comment, I understand the bug title is rather misleading. It looks like it should be moved to virt-viewer.

Comment 5 David Jaša 2014-04-16 11:42:39 UTC
Probably. What about the dangling sshd processes?

Comment 6 Marc-Andre Lureau 2014-04-16 11:47:31 UTC
(In reply to David Jaša from comment #5)
> Probably. What about the dangling sshd processes?

they are not started by spice server, but by virt-viewer. If qemu exited, this bug has probably very little to do with qemu/spice-server side.

Comment 7 Marc-Andre Lureau 2014-07-03 11:51:59 UTC
this has to do with nc not leaving on server disconnect. Sadly, I don't see any nc option that would change that behaviour. When using --recv-only, nc quits, but that's not what we want.

Daniel, what do you think?

Comment 8 Marc-Andre Lureau 2014-07-06 22:34:24 UTC
*** Bug 1075959 has been marked as a duplicate of this bug. ***

Comment 10 Christophe Fergeau 2014-08-06 08:49:54 UTC
virt-viewer can ask libvirt to get a notification from libvirt when the guest state changes. It should then be possible to close the tunnel and clean things up when a "shutdown" event is detected.

Comment 11 Christophe Fergeau 2014-08-06 10:45:42 UTC
(In reply to Christophe Fergeau from comment #10)
> virt-viewer can ask libvirt to get a notification from libvirt when the
> guest state changes. It should then be possible to close the tunnel and
> clean things up when a "shutdown" event is detected.

Actually, if the reboot is done from within the guest, I'm not sure libvirt will be able to emit an event.

Comment 14 CongDong 2014-10-14 06:10:40 UTC
I can reproduce with virt-viewer-0.6.0-7.el7.x86_64

VERIFY with virt-viewer-0.6.0-8.el7.x86_64

Steps:
1. Prepare spice guest on host A, install virt-viewer on host B
2. Install "socat" on two hosts
3. On B:
# virt-viewer -c qemu+ssh://root.4.104/system $vm
4. on A:
# virsh destroy $vm

Retest the case, and shutdown the guest within it

Result, virt-viewer connection on host B closes ASAP after the guest is power off.

As the result, set VERIFIED.

Comment 16 errata-xmlrpc 2015-03-05 13:38:31 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-2015-0295.html


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