"Sync Repository on Smart Proxy(ies)" tasks stuck on planned

Problem:

I have noticed today during a foreman-rake katello:upgrade_check run, that I had ~50 active tasks. When I have checked I have found that I have lots of “Sync Repository on Smart Proxy(ies)” tasks (Actions::Katello::Repository::CapsuleSync) in state planned although it also shows result as success. Those seem to count towards those active tasks.

There are also a lot of other task instance for this which have finished just fine and are now stopped/success. I am not sure why some hang in planned while others don’t. 8 of those tasks seem to have started after the last repository syncs, only two of them reached stopped.

I am also somewhat surprised to see those tasks at all: They have started after the last repository syncs. However, I don’t sync the Library environment to my smart proxies but only two environments “Testing” and “Production”, both only containing published content views.

Thus, there should be no smart proxy sync after the repository syncs. I did not publish any new content view version.

So it’s unclear to me why they have been planned/started at that time and also why some of them are stuck in planned.

Expected outcome:
No hanging tasks.

Foreman and Proxy versions:
katello-4.17.1-1.el9.noarch
foreman-3.15.1-1.el9.noarch

Distribution and version:
AlmaLinux release 9.7 (Moss Jungle Cat)

2 Likes

Are there any run phase steps in these unexpected Sync repo on capsule tasks in Dynflow? Do you see Bulk actions with ::Actions::Katello::CapsuleContent::Sync planned after the repo sync as well?

Another question, do you have rolling CVs in your environment?

1 Like

No. There are no run steps. If I understand it correctly, the task itself is empty. The Dynflow console only shows Actions::Katello::Repository::CapsuleSync in the Plan section, nothing on Run or Finalize section and the Execution History says that the start and end times are the same. There are no sub tasks, either.

There are also no Actions::Katello::CapsuleContent::Sync tasks after the repo sync. Those only appear after the content view publish & promote at other times of the day. So those are expected. During the morning, I do those publish & promotes, which trigger a Actions::Katello::ContentView::CapsuleSync "Sync Content View on Smart Proxy(ies)
" with two sub tasks for my two smart proxies. That’s how it should be.

I don’t know why those Actions::Katello::Repository::CapsuleSync get triggered in the first place. There is nothing for the smart proxies to sync.

It don’t have rolling CVs, only old fashioned published content views.

1 Like

I didn’t check the version 4.17 and the relevant code correctly earlier..On 4.17 those tasks are indeed planned..

This fixes the unnecessary async repo capsule sync tasks: Fixes #38546 - Do not run unnecessary Repository::CapsuleSync tasks by quba42 · Pull Request #11433 · Katello/katello · GitHub . This made it to 4.18.

2 Likes

Thanks. I’ll check once I have updated to 4.18.

1 Like

For those who don’t like katello:upgrade_check complaining about active tasks, you can clean them out. I found that cancel and force cancel in the gui doesn’t work. But rake gets it done:

# foreman-rake foreman_tasks:cleanup:run NOOP=TRUE VERBOSE=TRUE STATES='planned' TASK_SEARCH='label = Actions::Katello::Repository::CapsuleSync AND result = success'
[noop] deleting all tasks matching filter (label = Actions::Katello::Repository::CapsuleSync AND result = success) AND (state ^ (planned))
[noop] 15 tasks matching filter would be deleted
[noop] 0 orphaned task locks would be deleted
[noop] 0 orphaned task links would be deleted
[noop] 0 orphaned execution plans would be deleted
[noop] 0 orphaned job invocations would be deleted

With NOOP=TRUE it doesn’t make changes but only counts the number of tasks. If you remove NOOP=TRUE from the command line (it seems setting NOOP=FALSE doesn’t do it) then those tasks will be erased from the database:

# foreman-rake foreman_tasks:cleanup:run VERBOSE=TRUE STATES='planned' TASK_SEARCH='label = Actions::Katello::Repository::CapsuleSync AND result = success'