This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2280509 - Pulp never purge the completed tasks
Summary: Pulp never purge the completed tasks
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.15.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Ian Ballou
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-05-15 01:30 UTC by Hao Chang Yu
Modified: 2024-06-06 17:39 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 17:39:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 37521 0 Normal New Pulp never purge the completed tasks 2024-05-30 18:42:15 UTC
Github pulp pulpcore issues 5378 0 None open Add a scheduled cleanup task to keep the tasks table reasonable 2024-05-15 05:33:49 UTC
Github pulp pulpcore pull 5379 0 None open Add schedule for task purge 2024-05-15 05:35:59 UTC
Red Hat Issue Tracker   SAT-25155 0 None Migrated None 2024-06-06 17:39:09 UTC

Description Hao Chang Yu 2024-05-15 01:30:39 UTC
Description of problem:
The completed Pulp tasks stay forever and never be purged by Pulp. For a busy Satellite environment, the number of completed tasks can easily reach millions of records.

Large tasks table may cause the following issues:

1. Large core_task table size (more than 10GB)
2. Affecting Pulp performance related to pulp task queries.


For example. we can see the following slow queries of core_task table in the database logs.
~~~
duration: 5173.306 ms  statement: SELECT 1 AS "a" FROM "core_task" WHERE ("core_task"."pulp_created" < 'xxxxxxxxxxxxx'::timestamptz AND "core_task"."state" IN ('waiting', 'running', 'canceling') AND "core_task"."reserved_resources_record" && (ARRAY['/pulp/api/v3/domains/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/', '/api/v3/distributions/', 'shared:/api/v3/distributions/'])::text[]) LIMIT 1

duration: 6680.679 ms  statement: SELECT 1 AS "a" FROM "core_task" WHERE ("core_task"."pulp_created" < 'xxxxxxxxxxxxx'::timestamptz AND "core_task"."state" IN ('waiting', 'running', 'canceling') AND "core_task"."reserved_resources_record" && (ARRAY['/pulp/api/v3/domains/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/', '/api/v3/distributions/', 'shared:/api/v3/distributions/'])::text[]) LIMIT 1
~~~

Additional info:
The workaround to use pulp command to purge the tasks.

E.g. the below command will purge the completed tasks older than 2 weeks.
~~~
pulp --force task purge --finished-before $(date --date="$(date) -2 week"  +%Y-%m-%d) --state completed --state failed --state canceled
~~~

Comment 1 Daniel Alley 2024-05-15 02:18:15 UTC
Pulp already provides an API for purging tasks, but like orphan cleanup, calling it occasionally is up to the admin rather than something Pulp triggers automatically.  

I'm not sure what the correct component is for this though.

Comment 4 Ian Ballou 2024-05-28 18:44:59 UTC
Based on https://github.com/pulp/pulpcore/pull/5379/files, we now need to set the TASK_PROTECTION_TIME setting to enable automated task cleanup in Pulp.

I'm changing the component to "Installation".

It's noted that the issue is fixed in Pulpcore 3.54, so we'll either need to request a backport to Pulpcore 3.49 or wait another release to pick it up.

If needed in the short term, Katello could call the task purge API during orphan cleanup, but then the work to automate it in Pulpcore wouldn't be taken advantage of.

Moving back to NEW since the component has now changed to Installer.

Comment 11 Ian Ballou 2024-05-30 18:42:14 UTC
Created redmine issue https://projects.theforeman.org/issues/37521 from this bug

Comment 12 Eric Helms 2024-06-06 17:39:10 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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