feed-me icon indicating copy to clipboard operation
feed-me copied to clipboard

FeedMe job are not actually cancelled when released via the Queue Manager or via Feed Me settings

Open beckysolomon opened this issue 3 years ago • 5 comments

Description

When I "release" a Feed Me job in the Queue Manager, it says it is cancelled - and removes it from the craft_queue DB table - but the job keeps running (Feed Me keeps logging, and the number of CMS entries it creates keeps increasing).

image

image

Untitled

Steps to reproduce

  1. Start an import by clicking "Run feed" from the Feed Me plugin. The feed I'm running is a JSON feed of store locations mapping to entries with 8 fields, all of which are Plain Text.
  2. Go to the queue manager and click "Release all jobs". Or go to admin/feed-me/settings/general and click "Clear pending job queue"
  3. Go to Feed Me logs and notice that it is still processing nodes.
  4. Go to the entries list of the type you are importing from the feed. Notice that the number of entries keeps growing after a refresh

Additional info

  • Craft CMS version: Pro 3.5.15.1

  • Feed Me version: 4.3.1

  • PHP version: 7.3.31

  • Database driver & version: MySQL 8.0.26

  • Other plugins & versions: Amazon S3 1.2.11, Entry Instructions 1.0.7, Freeform 3.9.1, Imager v2.4.0, Incognito Field 1.2.0, Neo 2.8.14, Reasons 2.2.2, Redactor 2.8.3, Sprout SEO 4.6.5, Stamp 2.1.0, Workflow 1.5.6

  • I also have a custom plugin that is hooking into Craft's Elements::EVENT_BEFORE_SAVE_ELEMENT event so that every time a store location entry is saved by Feed Me, a latitude and longitude lookup is done based on address field and added as two more fields to the entry.

beckysolomon avatar Oct 20 '21 23:10 beckysolomon

I have exactly the same issue, @beckysolomon can you tell me if the feed jobs you had problems with are paginated? I think for normal feeds its fine, I only had problems with the jobs that were triggered by the pagination offset, so the starting page is still able to be canceled, but as soon as the feed has started its first offset, you cant stop it anymore.

BTW: We also have custom logic that hooks into a few events, for example Process::EVENT_STEP_BEFORE_ELEMENT_SAVE

AUYT avatar Nov 15 '21 16:11 AUYT

@AUYT I do not have pagination. I do also have custom logic hooked into EVENT_STEP_BEFORE_ELEMENT_SAVE

beckysolomon avatar Nov 15 '21 18:11 beckysolomon

Any news on this?

nilsenpaul avatar May 23 '23 14:05 nilsenpaul

Whether releasing jobs via the queue manager or canceling from Feed Me, neither will kill any currently running jobs, only jobs that haven’t started yet.

php-fpm (or however PHP is running) has already kicked off a process that can’t easily be killed directly from PHP without exec'ing out to a shell, running a bunch of ps and grep commands trying to find the exact process the queue is running as and killing it, which isn’t something we want to do.

I guess this could be improved in Feed Me by not using the word “cancel," which implies it will work for running, too.

angrybrad avatar May 24 '23 16:05 angrybrad

Thanks for the answer! Then it's up to us to find a faster way to find and kill the process running the job(s).

nilsenpaul avatar May 25 '23 12:05 nilsenpaul