Bug 627737

Summary: Cancelling a repo sync, doesn't cancel the repo sync
Product: [Retired] Pulp Reporter: Jason Connor <jconnor>
Component: z_otherAssignee: Jason Connor <jconnor>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: jconnor, jmatthew, mmccune, pkilambi, pthomas
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 13:59:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 641987    

Description Jason Connor 2010-08-26 19:27:16 UTC
Description of problem:
If you cancel a repo sync, the "main" sync thread gets interrupted, but because the sync is itself threaded, the spawned child threads continue to pull in packages.

How reproducible:
Sync a repo through the web services and then cancel the sync and watch the progress updates


Steps to Reproduce:
1. sync repo
2. cancel sync
3. watch progress updates
  
Actual results:
repo continues to sync

Expected results:
repo sync stops completely

Additional info:
This is such a bummer...

Comment 1 John Matthews 2010-09-09 15:05:55 UTC
Grinder has a 'stop' method that will tell all spawned threads to stop after they've finished the package they are downloading.

YumRepoGrinder.stop() is the method to invoke for 'yum' feeds.
RHNSync.stop() is the method to invoke for 'rhn' feeds.

Comment 2 Jason Connor 2010-09-09 21:12:33 UTC
monkey patched paython's stdlib threading module in order to track thread hierarchy and cancel not only a task's thread, but any child threads it may have spawned.

Comment 3 Preethi Thomas 2010-09-13 17:51:08 UTC
fails_qa
[root@preethi pulp]# rpm -qa |grep pulp
pulp-0.0.61-1.fc13.noarch
pulp-client-0.0.61-1.fc13.noarch
pulp-common-0.0.61-1.fc13.noarch
You have new mail in /var/spool/mail/root
[root@preethi pulp]# rpm -qa |grep grinder
grinder-0.0.60-1.fc13.noarch


I ran repo sync in one terminal window and while its running I cancelled the sync from another terminal window.  Even though I got the cancelled sync message ,the sync continued and finished successfully.

root@preethi ~]# pulp-admin  repo cancel_sync --id=f13   --taskid=58211bd7-bf60-11df-a0a9-002564a85a58
 Sync task 58211bd7-bf60-11df-a0a9-002564a85a58 cancelled


[root@preethi pulp]# pulp-admin  repo sync --id=f13
Task created with ID:: 58211bd7-bf60-11df-a0a9-002564a85a58
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: finished
 Sync Successful. Repo [ f13 ] now has a total of [ 3102 ] packages

Comment 4 Jason Connor 2010-09-14 15:35:21 UTC
Fixed another bug that was introduced by using weak references. This should be (again) fixed.

Comment 5 Preethi Thomas 2010-09-16 15:54:14 UTC
fails_qa

I started a sync for a repo, and while it was running, I did a cancel_sync for that repo. I got the sync task cancelled message but the actual sync continued and finised.

[root@preethi ~]# pulp-admin -u admin -p admin repo sync --id=f13
Task created with ID:: ac84bf0c-c1ab-11df-804b-002564a85a58
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: running
Sync Status:: finished
 Sync Successful. Repo [ f13 ] now has a total of [ 3102 ] packages
You have new mail in /var/spool/mail/root


[root@preethi ~]# pulp-admin -u admin -p admin repo cancel_sync --id=f13 --taskid=ac84bf0c-c1ab-11df-804b-002564a85a58
 Sync task ac84bf0c-c1ab-11df-804b-002564a85a58 cancelled
You have new mail in /var/spool/mail/root

Comment 6 Jay Dobies 2010-10-26 14:47:13 UTC
Fixed in build 0.76.

Comment 7 Preethi Thomas 2010-10-28 15:04:23 UTC
verified

[root@preethi ~]# pulp-admin repo status --id=f13
+------------------------------------------+
               Status for f13
+------------------------------------------+
Repository: f13
Number of Packages: 3102
Last Sync: 2010-10-27 11:57:16.131000

[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin repo sync --id=f13 -F
Sync for repository f13 started
You can safely CTRL+C this current command and it will continue
[==                                                ] 5% (181 of 3111 pkgs)
Sync: Canceled

[root@preethi ~]# pulp-admin repo status --id=f13
+------------------------------------------+
               Status for f13
+------------------------------------------+
Repository: f13
Number of Packages: 3102
Last Sync: 2010-10-27 11:57:16.131000

[root@preethi ~]# 
[root@preethi ~]# 



[root@preethi ~]# pulp-admin repo cancel_sync --id=f13
Sync for repository f13 canceled

Comment 8 Preethi Thomas 2011-08-16 13:59:11 UTC
Closing with Community Release 15

pulp-0.0.223-4.