Foreman Tasks stuck for days, unable to cancel

Problem:
I am not able to stop, cancel, nor force cancel stuck tasks in Foreman, mostly stuck sync plans and proxy sync tasks. Therefore I am also not able to publish the contents to Library.

Expected outcome:
Tasks cancelled and Publish tasks successfully executed

Foreman and Proxy versions:
foreman-3.15.0-1.el9.noarch
foreman-proxy-3.15.0-1.el9.noarch

Foreman and Proxy plugin versions:
foreman-3.15.0-1.el9.noarch
foreman-proxy-3.15.0-1.el9.noarch

Distribution and version:
RHEL9 - 5.14.0-611.30.1.el9_7.x86_64

Will provide any output or logs if required.
I have tried to cancel tasks, including force cancel, but they keep “running” or I’d say they are stuck as the progress is none for days, this started on last Thursday 5th of March 2026.

Thanks for any hints.

Brgds, Jan

Patched Foreman to 3.15.1, but the problem still persist, those tasks are still hanging around.

foreman-3.15.1-1.el9.noarch
foreman-cli-3.15.0-1.el9.noarch
foreman-client-release-3.13.1-1.el9.noarch
foreman-dynflow-sidekiq-3.15.1-1.el9.noarch
foreman-installer-3.15.0-1.el9.noarch
foreman-installer-katello-3.15.0-1.el9.noarch
foreman-postgresql-3.15.1-1.el9.noarch
foreman-proxy-3.15.0-1.el9.noarch

I must be running katello which you don’t list in the versions.

You should run katello:upgrade_check before any upgrade which you didn’t seem to do because it would complain about those tasks.

I also assume that you fully restarted foreman/katello with all its processes after the update.

You can clean out stuck tasks using foreman_tasks:cleanup:run as mentioned for instance in “Sync Repository on Smart Proxy(ies)” tasks stuck on planned

You don’t mentioned the exact states those tasks are in. When using foreman_tasks:cleanup:run make sure to test your filter with NOOP=TRUE before really running it. You don’t want to delete the scheduled/planned tasks accidentally.

Apologies for missing Katello information, I do run this version:

rpm -qa | grep ^katello | sort

katello-4.17.2-1.el9.noarch
katello-certs-tools-2.10.0-1.el9.noarch
katello-client-bootstrap-1.7.9-2.el9.noarch
katello-common-4.17.2-1.el9.noarch
katello-repos-4.17.1-1.el9.noarch
katello-selinux-5.2.0-1.el9.noarch

All those tasks were in running/pending state and not progressing when checked with hammer task progress command

foreman=# select id, label, started_at, state, result from foreman_tasks_tasks where state = ‘running’;
id | label | started_at | state | result
--------------------------------------±-----------------------------------±------------------------±--------±--------
5c2f4b07-a839-4dff-a9fe-8fffe39eda35 | Actions::Katello::Repository::Sync | 2026-03-06 03:10:15.763 | running | pending
(1 row)

In the whole desperation I eventually found this article:

Even old, from 2017, the procedure worked and I could have stopped all tasks.

Brgds, Jan

I wrote how you can solve it in the current version. That old article is overly complicated and has a high potential to break the whole system. It’s bad advice for anyone reading this thread. Do not try desperate things. Provide the information I have requested and use the command I told you should use.

As I wrote before, you can clean up tasks with foreman_tasks:cleanup:run. That’s how it’s supposed to be done.

Hello gvde,

Thanks! I only saw your update later, after I managed to fix it. Understood, that could have been dangerous. Should I run into this problem again, I will try to follow the recommended procedure. In the meanwhile I also hope that patched Foreman & Katello might have fixed some of these problems.

Regards
Jan

1 Like