Source URL reverting to older value after queued feed import

Created on 15 January 2021, almost 4 years ago
Updated 28 June 2024, 4 months ago

Problem/Motivation

The source URL set within a feed content item reverts to a previous value after a cron run. This seems to be related to a stale queue entry in the database, which references the previous source URL value (and which fails due to a 404 from that previous value).

My guess is that the 404 failure updates the "active" status of the feed item to "inactive", but inadvertently also overwrites the new source URL with the old source URL from the queue data. It's possible that the error also means the queue item doesn't "complete", since it appears to persist in the database after the cron run.

The cron run reports the 404 error from the old source URL:
RuntimeException: The feed from <em class="placeholder">[OLD-SOURCE-URL]</em> seems to be broken because of error "<em class="placeholder">Client error: `GET [OLD-SOURCE-URL]` resulted in a `404 NOT FOUND` response: [HTML-404-ERROR-CONTENT]</em>". in Drupal\feeds\Feeds\Fetcher\HttpFetcher->get() (line 165 of /app/web/modules/contrib/feeds/src/Feeds/Fetcher/HttpFetcher.php).

In my case the queue item name is feeds_feed_refresh:localgroup_feed.

Steps to reproduce

I'm not 100% sure what has created the situation I'm in, but it seems you can replicate it by:

  1. Create a new feed with a bad source URL, e.g. with a 404 response, and save without importing
  2. Run the "Import in background" operation to add a queue database entry referencing that bad source URL
  3. Change the feed's source URL through the GUI
  4. Run cron (or just wait for the next run)
  5. Bad things happen:
    • The bad source URL reappears in the feed item config.
    • The "active" state of the feed reverts to what it was when the queue item was created.
    • The import-in-background queue item remains in the queue.

Proposed resolution

Editing a feed item should clear out any related queued actions.

(Manually deleting the queue entry has resolved my immediate issue.)

Remaining tasks

Ensure queue items are removed when a feed is updated.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Closed: cannot reproduce

Component

Code

Created by

🇬🇧United Kingdom jrsouth

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada joelpittet Vancouver

    This has been a while, I am going to close as fixed and remove MR 22 patch from my sites. If someone chimes in with it still happening we can re-open. Just triaging ;)

Production build 0.71.5 2024