Bug 1092818

Summary: Can't kill the running virt-who by press "ctrl+c" key one time when virt-who is running on the CLI
Product: Red Hat Enterprise Linux 5 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: gaoshang <sgao>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.11CC: liliu, ovasik, qianzhan, sgao
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.9-5.el5 Doc Type: Bug Fix
Doc Text:
no docs needed
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-16 00:29:33 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:

Description Liushihui 2014-04-30 03:45:00 UTC
Description of problem:
When virt-who is running on the CLI , it need to press "ctrl+c" key more than one time to kill the running virt-who, And it will generate some error log in the terminal when press "ctrl+c" at the first time.

Version-Release number of selected component (if applicable):
virt-who-0.9-2.el5
subscription-manager-1.8.22-1.el5
python-rhsm-1.8.18-1.el5

How reproducible:
Always

Steps to Reproduce:
1. Register system to SAM server and make sure virt-who stopped
#[root@dhcp-128-110 ~]# service virt-who status
virt-who is stopped
2. On the terminal1, run virt-who.
[root@dhcp-128-110 libvirt-test-API]# virt-who -i 3 -d
3. Kill the running virt-who with press "ctrl+c" on the terminal1.
4. Check the virt-who stauts on the terminal2, virt-who still run normally
#[root@dhcp-128-110 ~]# ps -ef|grep python
root      2190     1  0 Apr24 ?        00:00:00 /usr/bin/python ./hpssd.py
root      2644     1  0 Apr24 ?        00:00:00 /usr/bin/python -tt /usr/sbin/yum-updatesd
root      3088     1  0 Apr24 ?        00:00:00 /usr/bin/python -tt /usr/bin/puplet
root     32019 22088  0 22:21 pts/2    00:00:00 /usr/bin/python /usr/share/virt-who/virt-who.py -i 10 -d
root     32030  3383  0 22:22 pts/3    00:00:00 grep python

Actual results:
After step3, It can't kill the running virt-who and it will generate some error log in the terminal1 
WARNING: Listening for events is not available in VDSM, ESX, RHEV-M or Hyper-V mode
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3 seconds interval
DEBUG: Sending list of uuids: []
ERROR: Error in communication with subscription manager, trying to recover:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 205, in _send
    self.subscriptionManager.sendVirtGuests(virtualGuests)
  File "/usr/share/virt-who/subscriptionmanager.py", line 84, in sendVirtGuests
    self.connection.updateConsumer(self.uuid(), guest_uuids=uuids)
  File "/usr/lib64/python2.4/site-packages/rhsm/connection.py", line 717, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python2.4/site-packages/rhsm/connection.py", line 490, in request_put
    return self._request("PUT", method, params)
  File "/usr/lib64/python2.4/site-packages/rhsm/connection.py", line 429, in _request
    response = conn.getresponse()
  File "/usr/lib64/python2.4/httplib.py", line 872, in getresponse
    response.begin()
  File "/usr/lib64/python2.4/httplib.py", line 336, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python2.4/httplib.py", line 294, in _read_status
    line = self.fp.readline()
  File "/usr/lib64/python2.4/socket.py", line 325, in readline
    data = recv(1)
  File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 217, in read
    return self._read_bio(size)
  File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 202, in _read_bio
    return m2.ssl_read(self.ssl, size, self._timeout)
  File "/usr/share/virt-who/virt-who.py", line 339, in cleanup
    sys.exit(0)
SystemExit: 0
DEBUG: Sending list of uuids: []
DEBUG: Sending list of uuids: []
DEBUG: Sending list of uuids: []
DEBUG: Sending list of uuids: []

Expected results:
It should kill the running virt-who after press "ctrl+c" one time, and it shouldn't generate any error log on the terminal

Additional info:
It hasn't this problem in the RHEL7

Comment 1 Radek Novacek 2014-04-30 10:54:56 UTC
The code that handles service restart is the same as for handling keyboard interrupts. So fixing bug 1092811 will fix this bug too.

*** This bug has been marked as a duplicate of bug 1092811 ***

Comment 2 Liushihui 2014-06-16 02:55:06 UTC
Although bug 1092811 has been verified on virt-who-0.9-4.el5, This bug still exist , Therefore , I reopen it.

Version-Release number of selected component (if applicable):
virt-who-0.9-4.el5
subscription-manager-1.11.3-5.el5
python-rhsm-1.11.3-3.el5

How reproducible:
Always

Steps to Reproduce:
1. Register system to SAM server and make sure virt-who stopped
#[root@dhcp-128-110 ~]# service virt-who status
virt-who is stopped
2. On the terminal1, run virt-who.
[root@dhcp-128-110 libvirt-test-API]# virt-who -i 3 -d
3. Kill the running virt-who with press "ctrl+c" many times on the terminal1.
4. Check the virt-who stauts on the terminal2
# ps -ef|grep virt-who

Actual results:
After step3, virt-who process can't stop on the terminal1,
After step4, virt-who still run normally.
[root@hp-z220-03 ~]# ps -ef|grep virt-who
root      4047  3756  0 22:43 pts/2    00:00:00 /usr/bin/python /usr/share/virt-who/virt-who.py -i 3 -d
root      4053  3788  0 22:44 pts/3    00:00:00 grep virt-who

Comment 3 Radek Novacek 2014-06-19 09:05:27 UTC
True, CTRL+C is not handled correctly, this is easy fix.

Comment 4 RHEL Program Management 2014-06-19 09:28:16 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 Radek Novacek 2014-06-19 10:51:26 UTC
Fixed in virt-who-0.9-5.el5.

Comment 7 Liushihui 2014-06-27 06:45:27 UTC
Verified on virt-who-0.9-5.el5

Comment 9 errata-xmlrpc 2014-09-16 00:29:33 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-1206.html