Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix action executor to prevent blocking Taskomatic for actions that are already finished #7416

Merged

Conversation

wweellddeerr
Copy link
Contributor

What does this PR change?

The server actions can be manually cancelled via Web UI, so this PR changes the code to check if all server actions have already finished before putting the Taskomatic thread to sleep. It should prevent blocking the Taskomatic for actions that will never appear in the database.

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed: only internal and user invisible changes

  • DONE

Test coverage

  • No tests: already covered

  • DONE

Links

Port of https://github.com/SUSE/spacewalk/pull/22295

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@wweellddeerr wweellddeerr requested a review from a team as a code owner August 14, 2023 22:00
@wweellddeerr wweellddeerr requested review from lucidd and removed request for a team August 14, 2023 22:00
@github-actions
Copy link
Contributor

Suggested tests to cover this Pull Request


private boolean allServerActionsFinished(Action action) {
return action != null &&
!CollectionUtils.isEmpty(action.getServerActions()) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean an action with no server actions does never count as having all server actions finished?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess it makes sense given the countQueuedServerActions(action) == 0 check already. I'm not exactly sure in what scenario an action would be saved and scheduled without server actions and then in a separate transaction server actions get added. It sounds like all kinds of problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know if it is possible to have an action here that has no server actions reaching this point of the code. I agree that it would be very problematic.

I just know that it is not what I'm searching for, maybe it just never happens. My point is that if the action has server actions and they are all finished I should not block the Taskomatic thread waiting for actions to appear as QUEUED in the database.

If this hypothetical case (having action without server actions) eventually happens I just want to keep the behavior exactly like it is today, and that is the reason to check if the list is not empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you OK with that? I can remove this check or even rename the method if you think it is necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its fine for now. The code suggests that there are cases where the action has no server actions initially. The whole action hand off between tomcat and taskomatic seems just very fragile so i think this needs some proper way in the future.

@lucidd lucidd self-requested a review August 16, 2023 09:21
@wweellddeerr wweellddeerr merged commit 07c540e into uyuni-project:master Aug 16, 2023
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants