Page MenuHomePhabricator

JSON serialization failures on media files
Open, Needs TriagePublic

Description

See https://logstash.wikimedia.org/goto/12b0f637fc0a134638415fa4558737c3

Seems to be related to the backport of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1030124 which happened at that time, but which fixed other bugs on Discussion Tools.

Event Timeline

Change #1031918 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@wmf/1.43.0-wmf.5] [ParserCache] Preserve information from the JsonException when logging failures

https://gerrit.wikimedia.org/r/1031918

Questions are: /who/ is adding non-serializable data to the ParserOutput, and /when/. Our suspicion is that somehow ParserOutput::getText() is being called on the ParserOutput *before* it is written to the cache, so that modifications made in the OutputTransform pipeline are being retroactively applied to the cached content.

Change #1031918 merged by jenkins-bot:

[mediawiki/core@wmf/1.43.0-wmf.5] [ParserCache] Preserve information from the JsonException when logging failures

https://gerrit.wikimedia.org/r/1031918

Mentioned in SAL (#wikimedia-operations) [2024-05-15T20:12:15Z] <samtar@deploy1002> Started scap: Backport for [[gerrit:1031918|[ParserCache] Preserve information from the JsonException when logging failures (T365036)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-15T20:15:01Z] <samtar@deploy1002> cscott and samtar: Backport for [[gerrit:1031918|[ParserCache] Preserve information from the JsonException when logging failures (T365036)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-15T20:28:56Z] <samtar@deploy1002> Finished scap: Backport for [[gerrit:1031918|[ParserCache] Preserve information from the JsonException when logging failures (T365036)]] (duration: 16m 41s)

Change #1032046 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] [JsonCodec, ParserCache] Improve debugging of serializability failures

https://gerrit.wikimedia.org/r/1032046

The 1031918 patch was backported and worked, but the information gleaned was a little disappointing: https://logstash.wikimedia.org/app/discover#/doc/logstash-*/logstash-mediawiki-1-7.0.0-1-2024.05.15?id=qKHwfY8BS8vmb5K1Na1f

Exactly the same message was in json_message as in message, which means this isn't something that JsonCodec::detectNonSerializableData caught, which (in turn) means it's something /inside/ of a JsonSerializable. That is, some object's ::jsonSerialize() method is returning an array containing non-serializable things, and detectNonSerializableData doesn't bother looking inside of the array returned by jsonSerialize() because it assumes you know what you're doing if you implement that.

https://gerrit.wikimedia.org/r/1032046 is a "moar debugging!" patch, which adds additional information (type, class name) to all of the places which throw an "Unable to serialize JSON" JsonException, as well as adding a "try harder" version of detectNonSerializableData used by ParserCache when it detects a serialization failure in order to try to pinpoint the exact property path leading to the problematic content.

Change #1032411 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/core@master] Fix serialization errors in PageBundle extensiondata

https://gerrit.wikimedia.org/r/1032411

Change #1032046 merged by jenkins-bot:

[mediawiki/core@master] [JsonCodec, ParserCache] Improve debugging of serializability failures

https://gerrit.wikimedia.org/r/1032046

Change #1032435 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@wmf/1.43.0-wmf.5] [JsonCodec, ParserCache] Improve debugging of serializability failures

https://gerrit.wikimedia.org/r/1032435

Change #1032435 merged by jenkins-bot:

[mediawiki/core@wmf/1.43.0-wmf.5] [JsonCodec, ParserCache] Improve debugging of serializability failures

https://gerrit.wikimedia.org/r/1032435

Mentioned in SAL (#wikimedia-operations) [2024-05-16T21:49:54Z] <jsn@deploy1002> Started scap: Backport for [[gerrit:1032435|[JsonCodec, ParserCache] Improve debugging of serializability failures (T365036)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-16T21:52:46Z] <jsn@deploy1002> cscott and jsn: Backport for [[gerrit:1032435|[JsonCodec, ParserCache] Improve debugging of serializability failures (T365036)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-16T22:25:10Z] <jsn@deploy1002> Started scap: Backport for [[gerrit:1032435|[JsonCodec, ParserCache] Improve debugging of serializability failures (T365036)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-16T22:27:41Z] <jsn@deploy1002> jsn and cscott: Backport for [[gerrit:1032435|[JsonCodec, ParserCache] Improve debugging of serializability failures (T365036)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-16T22:47:08Z] <jsn@deploy1002> Finished scap: Backport for [[gerrit:1032435|[JsonCodec, ParserCache] Improve debugging of serializability failures (T365036)]] (duration: 21m 57s)

Change #1032605 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] POC: detect getText before cache save

https://gerrit.wikimedia.org/r/1032605

Change #1032411 merged by jenkins-bot:

[mediawiki/core@master] Fix serialization errors in PageBundle extensiondata

https://gerrit.wikimedia.org/r/1032411

Change #1032807 had a related patch set uploaded (by C. Scott Ananian; author: Isabelle Hurbain-Palatin):

[mediawiki/core@wmf/1.43.0-wmf.5] Fix serialization errors in PageBundle extensiondata

https://gerrit.wikimedia.org/r/1032807

Change #1032807 abandoned by Isabelle Hurbain-Palatin:

[mediawiki/core@wmf/1.43.0-wmf.5] Fix serialization errors in PageBundle extensiondata

Reason:

wmf.6 is deployed

https://gerrit.wikimedia.org/r/1032807