Skip to main content

Delay on YouTube Feeds

Most YouTube feeds have not sent new notifications since 2023-10-02 14:20 UTC.

We will be triggering a manual YouTube feeds over the next hour and all missing notifications will be sent. If you have any missing notifications after 2023-10-05 14:00 UTC please reach out to support.

Update 14:00: All updates have been sent. If you believe that you are still missing updates feel free to reach out.

The rest of this post is a technical analysis of the issue.

Background

This was caused due to recent emergency response to YouTube WebSub notifications. The emergency response was necessary is due to the following factors.

  • YouTube WebSub posts are not spec compliant and do not contain the required information to send notifications. Therefore FeedMail uses these notifications as a "ping" to re-fetch the feed.
  • YouTube often sends notifications before the entries appear in the feed. The exact reason is not known but sometimes entries do not appear for up to an hour after the WebSub push.
  • YouTube also sends notifications for older items that are no longer in the feed.

In order to provide real-time updates for YouTube and to reduce resource usage, FeedMail works around these quirks. The workaround looks roughly like this:

  • When receiving a WebSub notification FeedMail re-checks the feed.
  • If the items mentioned in the notification are not present in the feed we poll with backoff, waiting for the item to appear.
  • FeedMail holds the HTTP connection open while doing this polling to avoid acknowledging a notification where we haven't seen the feed item. This way if the update fails the WebSub hub will notify us again and we can recheck.

Incident

Starting on September 27th YouTube started sending us an increasing volume of WebSub notifications.

Analysis showed that most of these notifications were for old videos. (Often years old.) This resulted in the full backoff loop running without finding the video (as it would never appear). It appears that many of these updates are retries of the same notification, likely because the long polling backoff resulted in a timeout in the WebSub hub. While in general the retries were useful for videos that weren't found they were undesired and high volume for old videos that would never appear on the feed.

Mitigation

In order to cut back this unnecessary work a code change was deployed that changed how we handled these "ping" notifications. (Which today only affects YouTube.)

  • Entries published more than 14 days ago are ignored.
  • Instead of backing off with retries an error is returned if the feed isn't found. This relies on the hub's built-in retry capabilities and avoids long-standing HTTP requests.
  • Entries updated more than 4 hours ago return a success, even if the entry wasn't found. This provides an upper-bound to retries.

Outage

Unfortunately there was a bug in the logic that filtered out entries published more than 14 days ago that caused nearly all WebSub notifications to be ignored.

YouTube feeds would still update whenever the WebSub subscription expires (every 7 days) but notifications wouldn't be sent until then.

Resolution

A new version was deployed that corrected the filter condition. After this point notifications started being received normally.

Additionally all YouTube feeds were scheduled to be re-checked over the next hour to catch any missed entries.

Comments

Popular posts from this blog

Delivery Delays to Gmail

In the past 48 hours Google has started delaying the delivery of some FeedMail notifications. This is currently affecting about 10% of messages to Gmail users. These notifications will be resent with a delay. We also speculate that some notifications will be marked as spam.   Update : As of 2023-05-09 this appears to be resolved. If You Are Affected If you use Gmail you may be affected by this. Notifications may be delayed or marked as spam. If your notifications are marked as spam you can create a filter to avoid this. Use "from:*@feedmail.org" as the rule and select " Never send it to Spam". If your notifications are delayed we are unaware of any action that you can take. However marking notifications that ended up in your spam folder as "Not Spam" may help avoid future delays.  It does appear that these emails are eventually being accepted but we are unsure if that means that they are actually ending up in users' mailboxes (or even their spam folder

Updates to HTML Processing

Since its inception FeedMail has done processing on HTML content in feeds to ensure that it renders as expected in email form. At first this was fairly simple things like rewriting URLs to point to the correct location (many feeds use non-absolute URLs that won't work in email) but over time more complex transformations were added such as adding fallback content to media embeds without any. The full-text scraping feature requires even more complex processing as it requires stripping away most of the page and handling content that was designed for full-featured browsers. What changed? Recently FeedMail has migrated all HTML rewriting to use new infrastructure. This provides more flexibility and enabled new features (such as showing controls on all media embeds) and made our processing much more reliable. What does this mean to me? As a user you shouldn't see much difference. Overall the emails you receive should be better formatted but the difference will be subtle. Full-text sc

Email Headers

FeedMail now sets some email headers that advanced users can use to filter the messages that FeedMail sends. For example you can filter notifications in a specific category into a different folder. The headers that we set are documented in the FAQ . These headers have been being set on notifications for a few months now so you can use past messages to test your filters. If you have any questions, or would like to see other headers set to help your filtering please let us know .