Bug 1207984

Summary: virt-who will regenerate a new original process after restart it
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: gaoshang <sgao>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.7CC: gxing, hsun, ovasik, rbalakri, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.16-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 23:54:58 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 2015-04-01 07:19:05 UTC
Description of problem:
Although virt-who's configuration has not been updated, virt-who still regenerate a new original process after restart it.

Version-Release number of selected component (if applicable):
virt-who-0.12-2.el6.noarch
subscription-manager-1.14.1-1.el6.x86_64
python-rhsm-1.14.1-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Register system to satellite, configure virt-who run at esx mode
# cat /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=3
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=Library
VIRTWHO_ESX_SERVER=10.66.79.68
VIRTWHO_ESX_USERNAME=Administrator
VIRTWHO_ESX_PASSWORD=qwer1234P!
2.Restart virt-who at the first time and check the virt-who process, it will show two process
[root@rhel6 ~]# service virt-who restart
Stopping virt-who:                                         [FAILED]
Starting virt-who:                                         [  OK  ]
[root@rhel6 ~]# ps -ef|grep virt-who
root      2791     1  3 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2796  2791  4 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2799  2424  0 01:53 pts/0    00:00:00 grep virt-who
3.Restart virt-who at the second time and check the virt-who process, it will show three process
[root@rhel6 ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@rhel6 ~]# ps -ef|grep virt-who
root      2796     1  1 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2828     1  2 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2833  2828  2 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2837  2424  0 01:53 pts/0    00:00:00 grep virt-who
4. Restart virt-who at the third time and check the virt-who process, it will show four process.
[root@rhel6 ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@rhel6 ~]# ps -ef|grep virt-who
root      2796     1  0 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2833     1  1 01:53 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2863     1  4 01:54 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2868  2863  4 01:54 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      2871  2424  0 01:54 pts/0    00:00:00 grep virt-who

Actual results:
It will regenerate a new virt-who process after restart virt-who service

Expected results:
As virt-who's configure hasn't updated, it should not generate a new one. it will not regenerate a new one unless virt-who's configure has changed

Additional info:

Comment 2 Radek Novacek 2015-04-02 15:28:25 UTC
Fixed in virt-who-0.12-3.el6.

Comment 4 Liushihui 2015-04-27 07:42:53 UTC
Verified it on virt-who-0.12-5.el6.noarch

Verified process:
1. Check virt-who processes,there are two processes
[root@hp-z220-05 libvirt-test-API]# ps -ef|grep virt-who
root     28002     1  1 15:32 ?        00:00:05 /usr/bin/python /usr/share/virt-who/virtwho.py
root     28009 28002  0 15:32 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     28739 25168  0 15:38 pts/0    00:00:00 grep virt-who
2. Restart it many times
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 libvirt-test-API]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
3. Check the virt-who processes again.
[root@hp-z220-05 libvirt-test-API]# ps -ef|grep virt-who
root     28989     1  4 15:40 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     28995 28989  0 15:40 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     28999 25168  0 15:40 pts/0    00:00:00 grep virt-who

Result: After restart virt-who many times ,it still show two virt-who processes, therefore, verify it

Comment 5 Liushihui 2015-05-20 06:46:18 UTC
It has been reproduced on virt-who-0.12-8.el6.noarch. Sometimes, restart virt-who service will regenerate a new original virt-who process.Therefore, reopen it.

[root@rhel67latest ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@rhel67latest ~]# ps -ef|grep virt-who
root      3711     1  2 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3716  3711  2 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3719  2797  0 01:26 pts/1    00:00:00 grep virt-who
[root@rhel67latest ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@rhel67latest ~]# ps -ef|grep virt-who
root      3716     1  0 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3750     1  3 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3755  3750  5 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3757  2797  0 01:26 pts/1    00:00:00 grep virt-who
[root@rhel67latest ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@rhel67latest ~]# ps -ef|grep virt-who
root      3716     1  0 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3755     1  0 01:26 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3810     1  3 01:30 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3815  3810  4 01:30 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3818  2797  0 01:30 pts/1    00:00:00 grep virt-who

Comment 6 Radek Novacek 2015-05-26 06:35:39 UTC
Can you please show me the configuration with which this happens? I need to know what backend is not stopping properly.

Comment 7 Eko 2015-05-29 08:36:10 UTC
I think this bug is duplicated with Bug 1224190.
The basic reason is that virt-who sub-process can't be killed when executed "# service virt-who stop"

Comment 8 Radek Novacek 2015-06-02 06:51:02 UTC
Could you please retest this with virt-who-0.12-9.el6 to make sure that the bug is really fixed? Thanks.

Comment 10 Liushihui 2015-06-05 06:10:42 UTC
It still exist on virt-who-0.12-9.el6 since it will generate a new original process after restart virt-who. please see the detail as the following:
[root@hp-z220-05 ~]# ps -fe|grep virt-who                                                                                                                               
root      3233     1  1 14:07 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3239  3233  0 14:07 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3243  2769  0 14:07 pts/0    00:00:00 grep virt-who
[root@hp-z220-05 ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-05 ~]# ps -fe|grep virt-who
root      3239     1  0 14:07 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3268     1  8 14:07 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3274  3268  0 14:07 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      3278  2769  0 14:07 pts/0    00:00:00 grep virt-who

BTW,I will check it later on virt-who-0.12-10.el6

Comment 11 Radek Novacek 2015-06-09 06:43:21 UTC
Can you please install python-debuginfo and gdb packages on affected system, run following command and post the result here:

for p in $(pgrep -f virt-who); do gdb -ex py-bt --batch -p $p; done

Comment 12 Radek Novacek 2015-06-09 07:11:05 UTC
*** Bug 1223236 has been marked as a duplicate of this bug. ***

Comment 13 Liushihui 2015-06-10 02:10:47 UTC
Please see the detail as the following:
[root@hp-z220-05 ~]# rpm -q python-debuginfo
python-debuginfo-2.6.6-64.el6.x86_64
[root@hp-z220-05 ~]# rpm -q gdb
gdb-7.2-83.el6.x86_64
[root@hp-z220-05 ~]# for p in $(pgrep -f virt-who); do gdb -ex py-bt --batch -p $p; done
/usr/bin/python.#prelink# (deleted): No such file or directory.
Undefined command: "py-bt".  Try "help".
/usr/bin/python.#prelink# (deleted): No such file or directory.
Undefined command: "py-bt".  Try "help".
/usr/bin/python.#prelink# (deleted): No such file or directory.
Undefined command: "py-bt".  Try "help".
[New LWP 17105]
[Thread debugging using libthread_db enabled]
0x00000033cde0d9b0 in sem_wait () from /lib64/libpthread.so.0
#1 <built-in method acquire of _multiprocessing.SemLock object at remote 0x15b02d0>
#3 file '/usr/lib64/python2.6/multiprocessing/queues.py', in 'put'
#7 file '/usr/share/virt-who/virt/libvirtd/libvirtd.py', in '_run'
#10 file '/usr/share/virt-who/virt/virt.py', in 'run'
#13 file '/usr/lib64/python2.6/multiprocessing/process.py', in '_bootstrap'
#16 file '/usr/lib64/python2.6/multiprocessing/forking.py', in '__init__'
#27 file '/usr/lib64/python2.6/multiprocessing/process.py', in 'start'
#30 file '/usr/share/virt-who/virt/virt.py', in 'start'
#34 file '/usr/share/virt-who/virtwho.py', in 'run'
#37 file '/usr/share/virt-who/virtwho.py', in '_main'
#40 file '/usr/share/virt-who/virtwho.py', in 'main'
#44 file '/usr/share/virt-who/virtwho.py', in '<module>'
[New LWP 23298]
[New LWP 23297]
[Thread debugging using libthread_db enabled]
0x00000033cde0d9b0 in sem_wait () from /lib64/libpthread.so.0
#1 <built-in method acquire of _multiprocessing.SemLock object at remote 0xf7b150>
#3 file '/usr/lib64/python2.6/multiprocessing/queues.py', in 'put'
#7 file '/usr/share/virt-who/virt/libvirtd/libvirtd.py', in '_run'
#10 file '/usr/share/virt-who/virt/virt.py', in 'run'
#13 file '/usr/lib64/python2.6/multiprocessing/process.py', in '_bootstrap'
#16 file '/usr/lib64/python2.6/multiprocessing/forking.py', in '__init__'
#27 file '/usr/lib64/python2.6/multiprocessing/process.py', in 'start'
#30 file '/usr/share/virt-who/virt/virt.py', in 'start'
#34 file '/usr/share/virt-who/virtwho.py', in 'run'
#37 file '/usr/share/virt-who/virtwho.py', in '_main'
#40 file '/usr/share/virt-who/virtwho.py', in 'main'
#44 file '/usr/share/virt-who/virtwho.py', in '<module>'
[New LWP 23666]
[New LWP 23665]

Comment 14 Liushihui 2015-06-10 02:17:53 UTC
[root@hp-z220-05 ~]# ps -ef|grep virt-who
root      5136  4249  0 10:17 pts/0    00:00:00 grep virt-who
root     12566     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     13440     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     14157     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     17104     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py -i 5 -d
root     23296     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     23664     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     23738     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     23897     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     23970     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     24027     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     24094     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     24206     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     24783     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     24868     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     25737     1  0 Jun09 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py

Comment 15 Radek Novacek 2015-06-11 14:21:17 UTC
Ok, I have finally reproduced it and also figured out potential fix. But it's quite late for 6.7 - we would need a blocker for it.

The bug can be reproduced only when a lot of libvirt events occurs and virt-who is restarted right after it. So it shouldn't be much of a problem for real world usecases - I could only reproduce it using script because by hand I was too slow.

Let's move it to 6.8.

Comment 18 Radek Novacek 2015-12-17 12:30:17 UTC
Fixed by rebase to virt-who-0.16-1.el6.

Comment 20 Eko 2016-01-19 08:44:46 UTC
Verified, this issue can't be duplicated on virt-who-0.16-1.el6

Comment 22 errata-xmlrpc 2016-05-10 23:54:58 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/RHEA-2016-0859.html