Page MenuHomePhabricator

Switch Echo serialization format from PHP to JSON
Open, Needs TriagePublic

Description

Per T161647: RFC: Deprecate using php serialization inside MediaWiki, Echo should use JSON for serialization, not native serialize(). It stores some serialized data potentially forever (see T323236) so the switch will require a migration script.

PHP will lose the ability to unserialize the data (as it is using the older, deprecated variant of PHP serialization) in 9.0.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1121644 had a related patch set uploaded (by Pmiazga; author: Pmiazga):

[mediawiki/extensions/Echo@master] Log events that are not serializable with JSONCodec

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

Change #1121644 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Log events that are not serializable with JsonCodec

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

A few entries were logged this week: https://logstash.wikimedia.org/goto/39109f495a3eacfdedadb62f0d63821b all related to Flow, where Flow\Model\UUID is not JSON-serializable.

Event Type flow-new-topic has non JsonCodec serializable value in extra: $.board-workflow: Flow\Model\UUID
Event Type flow-post-edited has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-post-reply has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-summary-edited has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-topic-resolved has non JsonCodec serializable value in extra: $.topic-workflow: Flow\Model\UUID
Event Type flowusertalk-new-topic has non JsonCodec serializable value in extra: $.board-workflow: Flow\Model\UUID

A few entries were logged this week: https://logstash.wikimedia.org/goto/39109f495a3eacfdedadb62f0d63821b all related to Flow, where Flow\Model\UUID is not JSON-serializable.

Event Type flow-new-topic has non JsonCodec serializable value in extra: $.board-workflow: Flow\Model\UUID
Event Type flow-post-edited has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-post-reply has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-summary-edited has non JsonCodec serializable value in extra: $.revision-id: Flow\Model\UUID
Event Type flow-topic-resolved has non JsonCodec serializable value in extra: $.topic-workflow: Flow\Model\UUID
Event Type flowusertalk-new-topic has non JsonCodec serializable value in extra: $.board-workflow: Flow\Model\UUID

I wonder if that is the other end of the issues we're seeing in T388725: PHP Warning: Class __PHP_Incomplete_Class has no unserializer? Though those seem to only have started in -wmf.20 🤔

And looking at the above events, they only seem to have started in -wmf.18 (Feb 26th). Nevermind, I just saw that the respective change was merged only in February. I got confused by the ticket being 2 years old.

Change #1135710 had a related patch set uploaded (by Pmiazga; author: Pmiazga):

[mediawiki/extensions/Echo@master] Allow event_extra to be JSON

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

Change #1135710 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Allow event_extra to be JSON

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

Let me unassign this from our current work. The majority of work is done; there are two bits that are nice to have ( refactoring - move serialization to EventMapper and create a migration script to update the serialization format to old rows).