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

[4.x]: resave/entries with --limit and --queue leads to endless queuing #13387

Closed
derdritte opened this issue Jul 5, 2023 · 2 comments
Closed
Assignees

Comments

@derdritte
Copy link

What happened?

Description

Resaving of a limited amount of objects as a "queue job" leads to self-reproducing endless resaving jobs.
I am unsure if they actually do or resave anything, but they spawn to quick to cancel. Cancelling all jobs has to be timed just right, otherwise a new job will have been queued already, that will not be cancelled. I have only gotten rid of the respawning jobs by spamming the release-all-action in the browser (as that does not seem to be available on the console).

Steps to reproduce

  1. Run craft resave/entries --section <any-section> --limit 1 --queue
  2. Go to the Queue-Manager and wait up to 10 seconds

--offset instead of --limit causes the same behaviour and the amount does not seem to matter for either.

Expected behavior

A job for the resaving of the limited amount of entries to run, with no additional jobs queued.

Actual behavior

New "queue jobs" are added and run indefinitely. In one case it was adding new jobs in a way to block all other jobs.

Craft CMS version

4.4.11

PHP version

8.1.13

Operating system and version

ubuntu 18.04.6

Database type and version

postgres13.8

Image driver and version

No response

Installed plugins and versions

  • clubstudioltd/craft-asset-rev 7.0.0
  • craftcms/ckeditor 3.3.0
  • craftcms/element-api 3.0.1.1
  • craftcms/feed-me 5.1.2
  • verbb/super-table 3.0.8.1
@i-just
Copy link
Contributor

i-just commented Jul 6, 2023

Hi, thanks for reporting! The root cause is the fact that Yii’s ->count() doesn’t take offset and limit into consideration (more info can be found here: yiisoft/yii2#13846).

It caused a situation where, for example, if the section had 3 entries and you set the limit to 1, the total number of items to process was returned as 3, where it should have been 1. This led to an infinite loop when checking if all items were processed. Items processed were less than the total number of items (1 < 3)).

I raised a PR to adjust this.

@brandonkelly
Copy link
Member

Craft 4.4.16 is out with the fix for this. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants