Bug 1097333

Summary: Concurrent requests cause ForemanTasks::Lock errors
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: HammerAssignee: Ivan Necas <inecas>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, cwelton, inecas
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 12:28:49 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 Og Maciel 2014-05-13 15:02:46 UTC
Description of problem:

Running the CLI automation while UI automation was being run started to generate ForemanTasks::Lock for the CLI tasks.

Version-Release number of selected component (if applicable):

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.7-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.7-1.el6_5.noarch
* candlepin-tomcat6-0.9.7-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.7-1.el6sat.noarch
* foreman-compute-1.6.0.7-1.el6sat.noarch
* foreman-gce-1.6.0.7-1.el6sat.noarch
* foreman-libvirt-1.6.0.7-1.el6sat.noarch
* foreman-ovirt-1.6.0.7-1.el6sat.noarch
* foreman-postgresql-1.6.0.7-1.el6sat.noarch
* foreman-proxy-1.6.0.4-1.el6sat.noarch
* foreman-selinux-1.5.0-0.develop.el6sat.noarch
* foreman-vmware-1.6.0.7-1.el6sat.noarch
* katello-1.5.0-22.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.5-1.el6sat.noarch
* katello-installer-0.0.37-1.el6sat.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-katello-plugins-0.2-1.el6sat.noarch
* pulp-nodes-common-2.3.1-0.4.beta.el6sat.noarch
* pulp-nodes-parent-2.3.1-0.4.beta.el6sat.noarch
* pulp-puppet-plugins-2.3.1-0.4.beta.el6sat.noarch
* pulp-rpm-plugins-2.3.1-0.4.beta.el6sat.noarch
* pulp-selinux-2.3.1-0.4.beta.el6sat.noarch
* pulp-server-2.3.1-0.4.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.2.2-2.el6sat.noarch
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.0.8-1.el6sat.noarch
* rubygem-hammer_cli-0.1.0-12.el6sat.noarch
* rubygem-hammer_cli_foreman-0.1.0-12.el6sat.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.2-5.el6sat.noarch
* rubygem-hammer_cli_katello-0.0.3-22.el6sat.noarch

How reproducible:


Steps to Reproduce:
1. You'd have to run concurrent commands that create/fetch/delete resources via the CLI in order to trigger this
2.
3.

Actual results:


Expected results:


Additional info:

required lock: #<ForemanTasks::Lock:0x007fca88b128a8> conflicts wiht [#<ForemanTasks::Lock id: 9770, task_id: "cc234888-17cf-40fa-a2b6-302276f7e347", name: "read", resource_type: "User", resource_id: 1, exclusive: true>]
Could not create the hostgroup:
  required lock: #<ForemanTasks::Lock:0x007fca88b128a8> conflicts wiht [#<ForemanTasks::Lock id: 9770, task_id: "cc234888-17cf-40fa-a2b6-302276f7e347", name: "read", resource_type: "User", resource_id: 1, exclusive: true>]
[ERROR 2014-05-13 10:45:25 Exception]

RestClient::InternalServerError (500 Internal Server Error):
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
    /usr/lib/ruby/1.8/net/http.rb:543:in `start'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:63:in `post'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:195:in `send'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:195:in `http_call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:151:in `call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/resource.rb:14:in `call'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/lib/hammer_cli_foreman/commands.rb:107:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 1 Og Maciel 2014-05-13 15:12:11 UTC
Related to http://projects.theforeman.org/issues/5422

Comment 3 Ivan Necas 2014-05-13 15:55:30 UTC
https://github.com/Katello/katello/pull/4070

Comment 4 Ivan Necas 2014-07-08 12:26:20 UTC
This change was released as part of the Sat6 beta

Comment 5 Corey Welton 2014-08-13 14:52:38 UTC
I think this can be marked verified in Satellite-6.0.4-RHEL-6-20140806.0.  I queued up a whole slew of hammer commands to be run simultaneously from the CLI (like 20+)

Comment 6 Bryan Kearney 2014-09-11 12:28:49 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.