Problem
There are a number of failure modes that can result in DeferredUpdates not completing, including cases where the update is simply never executed (e.g., if request processing is terminated first) or fails upon execution (e.g., due transient database unavailability). Regardless of the specific cause, this can lead to inconsistency like that reported here, where a dependent update (e.g., to recentchanges) is lost, despite the earlier canonical update (e.g., to revision) on which it depends having completed.
What has been done thus far
Based on observations in T364245#11634977, we believe MediaWiki container termination (e.g., during code deployments) was one key trigger for the "never executed" case. This was the result of a combination of surprising load-balancing behaviors and MediaWiki container shutdown sequencing, which should be addressed with changes to (1) enable graceful drain of inbound listeners in envoy and (2) keep envoy running until after MediaWiki (php-fpm) has terminated.
As of 2026-03-26, these changes are live on all MediaWiki-on-k8s services, and from what we can observe directly (e.g., at the CDN T364245#11744238) we believe that the number of requests interrupted by container termination has been reduced.
Next steps
As noted above, there are other contributing failure modes that have been observed (e.g., T364245#11873888, T364245#11874144), some of which may point to new avenues for investigation. In addition, for the container-shutdown aspect we've already focused on, it may be possible to tune shutdown deadlines to further reduce the rate at which longer-running requests are interrupted (though noting that this has other implications for code deployments).
However, in order to decide what to focus on next (and how to measure the effectiveness of any changes made), we'll need a clearer / simpler mechanism to measure DeferredUpdates "loss" (vs. ad-hoc queries that can be challenging to construct and interpret) that can be correlated with potential triggers. This seems like the most valuable next step to move this forward.
Original description
Steps to replicate the issue (include links if applicable):
- Within 1 month of 2024-05-04....
- Run SELECT * FROM revision WHERE rev_id = 1222189171
- Exists
- Run SELECT * FROM recentchanges WHERE rc_this_oldid = 1222189171
What happens?:
- Zero results
What should have happened instead?:
- 1 result
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Other information (browser name/version, screenshots, etc.):
- Reported by @Nardog at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Edits_not_showing_up_on_watchlist%2Frecent_changes
{ "batchcomplete": true, "query": { "recentchanges": [ { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222213787, "old_revid": 1222203194, "rcid": 1772542572, "timestamp": "2024-05-04T16:33:57Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222203194, "old_revid": 1222201928, "rcid": 1772521250, "timestamp": "2024-05-04T15:11:44Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222201928, "old_revid": 1222201694, "rcid": 1772518905, "timestamp": "2024-05-04T15:01:27Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222201694, "old_revid": 1222200569, "rcid": 1772518444, "timestamp": "2024-05-04T14:59:29Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222200569, "old_revid": 1222195654, "rcid": 1772516346, "timestamp": "2024-05-04T14:50:52Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222195654, "old_revid": 1222191607, "rcid": 1772507180, "timestamp": "2024-05-04T14:16:51Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222191607, "old_revid": 1222191358, "rcid": 1772499599, "timestamp": "2024-05-04T13:43:06Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222191358, "old_revid": 1222190966, "rcid": 1772499204, "timestamp": "2024-05-04T13:40:49Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222190444, "old_revid": 1222190276, "rcid": 1772498030, "timestamp": "2024-05-04T13:32:03Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222190276, "old_revid": 1222189654, "rcid": 1772497930, "timestamp": "2024-05-04T13:31:06Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222189347, "old_revid": 1222189171, "rcid": 1772497077, "timestamp": "2024-05-04T13:23:01Z" }, { "type": "edit", "ns": 8, "title": "MediaWiki:Gadget-popups.js", "pageid": 14548523, "revid": 1222188881, "old_revid": 1211031259, "rcid": 1772496609, "timestamp": "2024-05-04T13:18:22Z" } ] } }
https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=history:
- 16:33, 4 May 2024 Novem Linguae (262,878 bytes) (+55) changed my mind. this has @file so should be /**
- 15:11, 4 May 2024 Novem Linguae (262,823 bytes) (+16) jsdoc/require-asterisk-prefix
- 15:01, 4 May 2024 Novem Linguae (262,807 bytes) (−56) no-mixed-spaces-and-tabs
- 14:59, 4 May 2024 Novem Linguae (262,863 bytes) (−10) jQuery.each -> $.each
- 14:50, 4 May 2024 Novem Linguae (262,873 bytes) (−43) no-useless-concat
- 14:16, 4 May 2024 Novem Linguae (262,916 bytes) (+45) jsdoc/valid-types
- 13:43, 4 May 2024 Novem Linguae (262,871 bytes) (−27) dot-notation
- 13:40, 4 May 2024 Novem Linguae (262,898 bytes) (−8) unicorn/prefer-date-now
- 13:36, 4 May 2024 Novem Linguae (262,906 bytes) (−560) prefer-regex-literals
- 13:32, 4 May 2024 Novem Linguae (263,466 bytes) (−1) trailing-spaces
- 13:31, 4 May 2024 Novem Linguae (263,467 bytes) (0) jsdoc/check-types
- 13:26, 4 May 2024 Novem Linguae (263,467 bytes) (0) operator-linebreak
- 13:23, 4 May 2024 Novem Linguae (263,467 bytes) (−7) no-unneeded-ternary
- 13:21, 4 May 2024 Novem Linguae (263,474 bytes) (0) wrap-iife
- 13:18, 4 May 2024 Novem Linguae (263,474 bytes) (−42) jsdoc/check-tag-names
Notice the revisions 1222189171 at 13:21, 1222189654 at 13:26, and 1222190966 at 13:36 are missing from the recentchanges results.
Root cause: scap backport deployments abruptly terminating DeferredUpdates that add rows to the recentchanges table.
The fix: SREs modified kubernetes settings to wait for DeferredUpdates to finish before terminating.
