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.
Comments
Post a Comment