Bug 695702

Summary: Error from deleting a repo while sync is in progress
Product: [Retired] Pulp Reporter: dgao
Component: z_otherAssignee: John Matthews <jmatthew>
Status: CLOSED CURRENTRELEASE QA Contact: dgao
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: pthomas, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 22   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 14:00:51 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 dgao 2011-04-12 13:20:18 UTC
201104120850:06.629 - FINE: ssh root.redhat.com pulp-admin repo sync --id mod_test_repo -F (com.redhat.qe.tools.SSHCommandRunner.run)
.
.
.




[root@pulp-qe pulp]# ps -elf | grep "pulp"
5 S apache   16306 16301  0  80   0 - 265473 poll_s 01:59 ?       00:03:00 (wsgi:pulp)    
4 S root     16383 15854  0  80   0 - 80671 sk_wai 01:59 ?        00:00:00 /usr/bin/python /usr/bin/pulp-admin repo sync --id mod_test_repo -F
0 S root     17197 17175  0  80   0 - 25787 pipe_w 08:49 pts/0    00:00:00 grep pulp

[root@pulp-qe pulp]# pulp-admin -u admin -p admin repo list
+------------------------------------------+
       List of Available Repositories
+------------------------------------------+

Id                 	f13test                  
Name               	f13test                  
Feed URL           	http://repos.fedorapeople.org/repos/pulp/pulp/fedora-13/x86_64/
Feed Type          	yum                      
Feed Certs         	No                       
Consumer Certs     	No                       
Architecture       	x86_64                   
Sync Schedule      	None                     
Packages           	10                       
Files              	0                        
Distributions      	None                     
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       


Id                 	mod_test_repo            
Name               	mod_repo_name            
Feed URL           	http://10.16.76.78/pub/updates
Feed Type          	yum                      
Feed Certs         	No                       
Consumer Certs     	No                       
Architecture       	noarch                   
Sync Schedule      	None                     
Packages           	0                        
Files              	0                        
Distributions      	None                     
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       



2011-04-12 01:59:15,456 [ERROR][Thread-6] failed() @ task.py:365 - Task id:fd928173-64c9-11e0-8e0f-54520052d5f4, method_name:_sync:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 313, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 1541, in _sync
    self.set_sync_in_progress(id, False)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 2045, in set_sync_in_progress
    if repo.has_key("sync_in_progress") and repo["sync_in_progress"]:
AttributeError: 'NoneType' object has no attribute 'has_key'

Comment 1 John Matthews 2011-04-12 13:29:16 UTC
2011-04-12 08:50:00,008 [INFO][MainThread] connect() @ broker.py:89 - {localhost:5672} connected to AMQP
2011-04-12 08:50:00,009 [INFO][MainThread] open() @ consumer.py:133 - {heartbeat} opening heartbeat;{create:always,node:{type:topic,durable:True},link:{durable:True,x-declare:{arguments:{no-local:True}}}}
2011-04-12 08:50:00,574 [INFO][Dummy-2] initialize() @ connection.py:41 - Attempting Database connection with seeds = pulp-nightly.usersys.redhat.com
2011-04-12 08:50:00,593 [INFO][Dummy-2] initialize() @ connection.py:46 - Database connection established with: seeds = pulp-nightly.usersys.redhat.com, name = pulp_database
2011-04-12 08:50:00,627 [WARNING][Dummy-2] schedule() @ task.py:269 - Task 60e87c73-6503-11e0-a733-5452004fdd6d: cull_history(, ) missed 1 scheduled runs
2011-04-12 08:50:00,628 [ERROR][Dummy-2] clear_all_sync_in_progress() @ repo.py:73 - r = SON([(u'_id', u'f13test'), (u'id', u'f13test'), (u'sync_in_progress', False)])
2011-04-12 08:50:02,921 [INFO][Dummy-5] sync() @ repositories.py:557 - sync timeout passed : None
2011-04-12 08:50:02,968 [INFO][Thread-6] _sync() @ repo.py:1496 - Sync of faux_test_repo starting, skip_dict = {}
2011-04-12 08:50:02,968 [INFO][Thread-6] sync() @ repo_sync.py:444 - Limiting download speed to 0 KB/sec per thread. [15] threads will be used
2011-04-12 08:50:03,964 [INFO][Thread-3] cancel() @ repo_sync.py:65 - RepoSyncTask cancel invoked
2011-04-12 08:50:04,240 [INFO][Dummy-5] delete() @ repo.py:492 - Delete API call invoked SON([(u'use_symlinks', False), (u'feed_key', None), (u'package_count', 0), (u'distributionid', []), (u'consumer_cert', None), (u'consumer_ca', None), (u'filters', []), (u'id', u'faux_test_repo'), (u'repomd_xml_path', u'/var/lib/pulp//repos/released/F-13/GOLD/Fedora/x86_64/os/repodata/repomd.xml'), (u'group_xml_path', u''), (u'publish', True), (u'source', SON([(u'url', u'http://download.devel.redhat.com/released/F-13/GOLD/Fedora/x86_64/os'), (u'type', u'yum'), (u'supported_types', [u'yum', u'local', u'rhn'])])), (u'sync_in_progress', True), (u'groupid', []), (u'consumer_key', None), (u'packagegroups', SON([])), (u'files', []), (u'relative_path', u'released/F-13/GOLD/Fedora/x86_64/os'), (u'arch', u'noarch'), (u'sync_schedule', None), (u'packages', []), (u'group_gz_xml_path', u''), (u'feed_cert', None), (u'name', u'faux_test_repo'), (u'feed_ca', None), (u'last_sync', None), (u'clone_ids', []), (u'packagegroupcategories', SON([])), (u'_ns', u'repos'), (u'release', None), (u'checksum_type', u'sha256'), (u'_id', u'faux_test_repo'), (u'errata', SON([]))])
2011-04-12 08:50:04,242 [INFO][Dummy-5] mkdir() @ keystore.py:202 - mkdir: /var/lib/pulp/published/gpg/released/F-13/GOLD/Fedora/x86_64/os
2011-04-12 08:50:04,243 [INFO][Dummy-5] unlink() @ keystore.py:187 - unlinking: /var/lib/pulp/published/gpg/released/F-13/GOLD/Fedora/x86_64/os
2011-04-12 08:50:04,245 [INFO][Dummy-5] delete() @ repo.py:582 - removing repo files .... /var/lib/pulp//repos/released/F-13/GOLD/Fedora/x86_64/os
2011-04-12 08:50:07,788 [ERROR][Thread-6] failed() @ task.py:388 - Task id:6246ddab-6503-11e0-b02b-5452004fdd6d, method_name:_sync:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 336, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 1550, in _sync
    self.set_sync_in_progress(id, False)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 2054, in set_sync_in_progress
    if repo.has_key("sync_in_progress") and repo["sync_in_progress"]:
AttributeError: 'NoneType' object has no attribute 'has_key'

Comment 2 John Matthews 2011-04-13 18:05:46 UTC
Commit here:
http://git.fedorahosted.org/git/?p=pulp.git;a=commitdiff;h=3fb4515887a793b954527fcc1507fdfa1c880ef6


We added a check for set_sync_in_progress, it guards against repo not being found when querying mongo.  Underlying issue is that we are allowing a repo to be deleted while it is being synced...and we are not stopping the sync.

Comment 3 Jay Dobies 2011-04-13 19:23:05 UTC
Fixed in build 0.163.

Comment 4 dgao 2011-04-15 14:24:07 UTC
[root@pulp-qe httpd]# yum info pulp
Installed Packages
Name       : pulp
Arch       : noarch
Version    : 0.0.163


[root@pulp-qe httpd]# pulp-admin repo create --id=foo --feed=yum:http://download.devel.redhat.com/released/F-14/GOLD/Fedora/x86_64/os/
Successfully created repository [ foo ]

[root@pulp-qe httpd]# pulp-admin repo sync --id=foo -F
Sync for repository foo started
Step: Downloading Items or Verifying
[                         ] 0%
Tree_Files: 0/7
Rpms: 39/2766
Total: 39/2773 items
^C

[root@pulp-qe httpd]# pulp-admin repo delete --id=foo
Successful deleted repository [ foo ]

[root@pulp-qe httpd]# nethogs

NetHogs version 0.7.0

  PID USER     PROGRAM                      DEV        SENT      RECEIVED       
6810  apache   (wsgi:pulp)                  eth0      25.437    1198.940 KB/sec


No error is outputted in the log from deleting the repo while sync is ongoing. 
Refer to https://bugzilla.redhat.com/show_bug.cgi?id=695707 for resolution of the underlying problem.

Comment 5 Preethi Thomas 2011-08-16 14:00:51 UTC
Closing with Community Release 15

pulp-0.0.223-4.