Bug 1402415 - "hammer repository upload-content --path" misbehaviour if RPM upload takes longer than hammer timeout is
Summary: "hammer repository upload-content --path" misbehaviour if RPM upload takes lo...
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer - Content
Version: 6.2.5
Hardware: All
OS: Linux
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
Depends On:
TreeView+ depends on / blocked
Reported: 2016-12-07 13:47 UTC by Pavel Moravec
Modified: 2020-04-15 14:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-09-04 17:57:40 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Pavel Moravec 2016-12-07 13:47:55 UTC
Description of problem:
User scenario: "hammer repository upload-content --path /mnt/of/slow/device" starts to upload packages to a repo, but randomly fails with error:

Failed to upload file 'kernel-debuginfo-4.2.0-300.ec2.x86_64.rpm' to repository. Please check the file and try again.

The reason is, hammer_cli_katello/repository.rb uses for each such RPM upload:

      def import_upload_ids(ids)
        params = {:id => get_identifier,
                  :upload_ids => ids
        resource.call(:import_uploads, params)

The "resource.call" can timeout on hammer timeout. That timeout event is silently ignored and next RPM is attempted to be uploaded. So new foreman task is kicked while previous one is still running - while it has acquired relevant locks. So the new task fails with "Required lock is already taken by other running tasks." error and hammer just logs "Failed to upload file" error.

That is confusing for a user. Please either ignore the timeout on this call, or preferably at least print the timeout event so the user knows something wrong happened.

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

How reproducible:

Steps to Reproduce:
1. To mimic slow package upload, artificially decrease hammer timeout by setting to /etc/hammer/cli.modules.d/foreman.yml ":request_timeout: 5"

2. Get some packages of few hundreds of MBs size (I used kernel-debuginfo) and put them to a directory (/tmp/many_rpms/ is used below)

3. Call in hammer shell:

product create --name=custom_product_with_many_repos --organization-id=1 --label=custom_product_with_many_repos

repository create --content-type=yum --download-policy=immediate --label=custom_repo_many_rpms --name=custom_repo_many_rpms --organization-id=1 --product=custom_product_with_many_repos

repository upload-content --path /tmp/many_rpms/ --product custom_product_with_many_repos --organization-id=1 --name custom_repo_many_rpms

Actual results:
Sporadic to frequent errors:

Failed to upload file 'kernel-debuginfo-4.2.0-300.ec2.x86_64.rpm' to repository. Please check the file and try again.

Expected results:
No such error, or at least preceded by timeout warning.

Additional info:

Comment 4 Bryan Kearney 2018-09-04 17:57:40 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.

Note You need to log in before you can comment on or make changes to this bug.