Clearing hung task from external PostgreSQL database

Hung repository sync task that I can’t seem to clear.
Expected outcome:
Repository sync completes successfully for all repositories.
Foreman and Proxy versions:
Foreman 3.0.0-0.1.rc2
Katello 4.2.0.rc1
Foreman and Proxy plugin versions:
foreman-tasks 5.0.0
foreman_ansible 6.4.1
foreman_leapp 0.1.7
foreman_puppet 1.0.0.rc.2
foreman_remote_excution 4.7.0
katello 4.2.0.rc1
Distribution and version:
CentOS 7.9
Other relevant data:
Hung sync for one repository from yesterday that won’t seem to clear completely causing that repository from finishing newer repo sync tasks. I used to be able to remove these types of issues from the db before I rebuilt my environment using an external database.

Well in my push to fix this issue I ran a foreman-rake task cleanup command that removed some key tasks and destroyed this system. Going to need to rebuild it and start over. I should have taken a snapshot before running the cleanup.

1 Like

Sorry to hear that. If you still have the brolen instance, what is the error now. We should never let the cleanup task break the system completely.

Unfortunately, there wasn’t just one error to go with this. In the webUI, I wasn’t able to see any of my content-views any longer, but could see them using the hammer command.

Also, some of the systems were in a strange state of registration and could not communicate with the Katello. I have a simple katello-migration script that I wrote that unregisters them from one Katello environment and registers to another so it wasn’t too bad moving ~400 systems over.

Here is the command that I ran based on the Red Hat solution article. I meant to run with NOOP=true first, but missed adding that option so it ran and removed >70,000 tasks.

foreman-rake foreman_tasks:cleanup TASK_SEARCH=‘label ~ *’ AFTER=‘100s’ VERBOSE=true

I have already destroyed this broken environment so I won’t be able to pull anything from it.