Bug 740254

Summary: Stack trace calculating dependencies in changeset
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: WebUIAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Garik Khachikyan <gkhachik>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.0.0CC: gkhachik, mkoci, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-0.1.235-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 17:57:34 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: 747354    

Description Mike McCune 2011-09-21 13:14:01 UTC
Steps to reproduce:

1) I setup a repo with a collection of packages
2) Promoted repo into next env
3) Added a series of packages to repo on disk, ran createrepo
4) Synced repo again into Katello
5) Went to promote a single package that was added during step 3 into a changeset.  This package had a series of dependencies that were also added in step 3.  Wanted to see those listed in the review step.
6) Saw error below:

Started GET "/katello/changesets/2/dependencies?_=1316610210722" for 127.0.0.1 at Wed Sep 21 06:03:30 -0700 2011
  Processing by ChangesetsController#dependencies as 
  Parameters: {"id"=>"2", "_"=>"1316610210722"}
Setting locale: en
Setting current user thread-local variable to admin
Authorizing admin for changesets/dependencies
Resource GET request: /pulp/api/repositories/?groupid=env%3A1
Processing response: 200
Resource GET request: /pulp/api/repositories/?groupid=env%3A2
Processing response: 200
Resource GET request: /pulp/api/repositories/1316547604527-repo2-ACME_Corporation/packages/
Processing response: 200
Resource POST request: /pulp/api/services/dependencies/, {"pkgnames":["katello-0.1.83-1.git.17.fc6a2f6.fc15.noarch"],"repoids":["1316547604527-repo2-ACME_Corporation"]}
Processing response: 200
Setting current user thread-local variable to nil
Completed   in 1822ms
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.collect
#<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.collect>
/home/mmccune/devel/katello/src/app/models/changeset.rb:123:in `calc_dependencies'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_collection.rb:431:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_proxy.rb:216:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_proxy.rb:216:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_proxy.rb:216:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_proxy.rb:216:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.5/lib/active_record/associations/association_collection.rb:431:in `method_missing'
/home/mmccune/devel/katello/src/app/models/changeset.rb:93:in `calc_dependencies'
/home/mmccune/devel/katello/src/app/controllers/changesets_controller.rb:105:in `dependencies'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/abstract_controller/base.rb:150:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/action_controller/metal/rendering.rb:11:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/abstract_controller/callbacks.rb:18:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:471:in `_run__2091943037__process_action__1450775643__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_207750'
/home/mmccune/devel/katello/src/lib/util/threadsession.rb:77:in `thread_locals'

Comment 1 Tomas Strachota 2012-01-09 14:39:28 UTC
There's been many changes in dependency calculation since this bug was filed.
Dep. calculation works without any runtime exception in katello 0.1.171-1.

Comment 4 Garik Khachikyan 2012-02-10 14:11:22 UTC
# REOPEN

I'm afraid but I need to reopen this issue for further investigations:

My scenario is: Let's assume we have built *some* katello packages:
---
katello-0.1.230-1.el6.noarch.rpm
katello-agent-0.14-1.git.0.8442e11.el6.noarch.rpm
katello-all-0.1.230-1.el6.noarch.rpm
katello-cli-0.1.54-1.git.0.2670189.el6.noarch.rpm
katello-cli-common-0.1.54-1.git.0.2670189.el6.noarch.rpm
katello-common-0.1.230-1.git.0.7ea815b.el6.noarch.rpm
katello-configure-0.1.63-1.git.0.02f9bbe.el6.noarch.rpm
katello-glue-candlepin-0.1.230-1.git.0.7ea815b.el6.noarch.rpm
katello-glue-foreman-0.1.230-1.git.0.7ea815b.el6.noarch.rpm
katello-glue-pulp-0.1.230-1.git.0.7ea815b.el6.noarch.rpm
katello-selinux-0.1.4-1.el6.noarch.rpm
---

Steps to do:
0. use org: ACME_Corporation
1. create env 
2. prepare provider/product/repo having file://</your/repodata/$(pwd)/here>
3. move some packages to another directory (let's say: katello, katello-all, katello-selinux)
4. createrepo ./ there
5. sync repo
6. prepare changeset and promote the content first time there
7. move back that 3 packages, recreate the repo again
8. re-sync repo
9. prepare another changest
10. add there *only* katello-0.1.230-1.el6.noarch
11. try to promote (and follow the /var/log/pulp/pulp.log)

For me it took about 10 min. and there were still processing a dependencies listing/calculation

Not sure if, let's say some of packages requires httpd, we need then go further and look for dependencies of httpd there ?

So to sumup - adding a simple package without some dependencies brings to some really long (maybe infinite?) loop there.

versions of reproducer:
---
pulp-0.0.265-1.el6.noarch
candlepin-0.5.17-1.el6.noarch
katello-0.1.230-1.git.0.7ea815b.el6.noarch
katello-cli-0.1.54-1.git.0.2670189.el6.noarch

Comment 5 Tomas Strachota 2012-02-12 22:53:45 UTC
Filtering already calculated dependencies was not working correctly and therefore circular dependencies were causing infinite loops.

Fixed in katello-0.1.235-1

Comment 6 Garik Khachikyan 2012-02-13 11:00:22 UTC
# VERIFIED

Really fixed now :)

I see added katello-selinux also while was adding katello package to the changeset only.

thanks Tomas for the fix.

checked against:
---
katello-0.1.235-1.git.0.737ec3f.el6.noarch
katello-cli-0.1.54-1.git.0.2670189.el6.noarch
pulp-0.0.265-1.el6.noarch
candlepin-0.5.17-1.el6.noarch

One note: there is a bug I've just opened which prevents syncing local repo-s until setenforce 0 is not set.

see: bz https://bugzilla.redhat.com/show_bug.cgi?id=789945