Page MenuHomePhabricator

Figure out why LexemeEditEntityTest::testGivenInvalidDataInClearRequest_errorIsReported is throwing an Exception/logging an error with AbuseFilter enabled
Open, Needs TriagePublic

Description

In an effort to resolve errors ending up in mw-error.log during a CI run in T249838: Fix WikibaseLexeme UnsupportedObjectExceptions in Wikibase CI builds, it was discovered that the tests LexemeEditEntityTest::testGivenInvalidDataInClearRequest_errorIsReported thows an UnsupportedObjectException if AbuseFilter is enabled that ends up in that file.

The exception logging for that test was temporarily disabled to clear the way for asserting that mw-error.log is empty during a CI run. However, we should still figure out why this happens in the first place and fix it properly.

Event Timeline

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

This was reported a year ago but still open, so moving to the backlog to be prioritized

This can also happen in production logstash, by the way:


Error
normalized_message
[{reqId}] {exception_url}   Serializers\Exceptions\UnsupportedObjectException: Can not serialize incomplete Lexeme
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.9/extensions/WikibaseLexeme/src/Serialization/StorageLexemeSerializer.php(109)
#0 /srv/mediawiki/php-1.37.0-wmf.9/extensions/WikibaseLexeme/src/Serialization/StorageLexemeSerializer.php(80): Wikibase\Lexeme\Serialization\StorageLexemeSerializer->getSerialized(Wikibase\Lexeme\Domain\Model\Lexeme)
#1 /srv/mediawiki/php-1.37.0-wmf.9/vendor/serialization/serialization/src/Serializers/DispatchingSerializer.php(42): Wikibase\Lexeme\Serialization\StorageLexemeSerializer->serialize(Wikibase\Lexeme\Domain\Model\Lexeme)
#2 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/lib/includes/Store/EntityContentDataCodec.php(152): Serializers\DispatchingSerializer->serialize(Wikibase\Lexeme\Domain\Model\Lexeme)
#3 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Content/EntityContent.php(327): Wikibase\Lib\Store\EntityContentDataCodec->encodeEntity(Wikibase\Lexeme\Domain\Model\Lexeme, string)
#4 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/RepoHooks.php(648): Wikibase\Repo\Content\EntityContent->getTextForFilters()
#5 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(338): Wikibase\Repo\RepoHooks::onAbuseFilterContentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent, NULL)
#6 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#7 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/Hooks/AbuseFilterHookRunner.php(89): MediaWiki\HookContainer\HookContainer->run(string, array)
#8 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/TextExtractor.php(85): MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner->onAbuseFilter_contentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent, NULL)
#9 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/AbuseFilterHooks.php(76): MediaWiki\Extension\AbuseFilter\TextExtractor->contentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent)
#10 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/AbuseFilterHooks.php(45): MediaWiki\Extension\AbuseFilter\AbuseFilterHooks::filterEdit(DerivativeContext, User, Wikibase\Lexeme\MediaWiki\Content\LexemeContent, string, string)
#11 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\AbuseFilter\AbuseFilterHooks::onEditFilterMergedContent(DerivativeContext, Wikibase\Lexeme\MediaWiki\Content\LexemeContent, Status, string, User, boolean, string)
#12 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#13 /srv/mediawiki/php-1.37.0-wmf.9/includes/Hooks.php(137): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#14 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditFilterHookRunner.php(105): Hooks::run(string, array)
#15 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/StatsdTimeRecordingEditFilterHookRunner.php(47): Wikibase\Repo\EditEntity\MediawikiEditFilterHookRunner->run(Wikibase\Lexeme\Domain\Model\Lexeme, DerivativeContext, string)
#16 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php(723): Wikibase\Repo\EditEntity\StatsdTimeRecordingEditFilterHookRunner->run(Wikibase\Lexeme\Domain\Model\Lexeme, DerivativeContext, string)
#17 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php(77): Wikibase\Repo\EditEntity\MediawikiEditEntity->attemptSave(Wikibase\Lexeme\Domain\Model\Lexeme, string, integer, string, boolean, array)
#18 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php(392): Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEditEntity->attemptSave(Wikibase\Lexeme\Domain\Model\Lexeme, string, integer, string, NULL, array)
#19 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Api/ModifyEntity.php(327): Wikibase\Repo\Api\EntitySavingHelper->attemptSaveEntity(Wikibase\Lexeme\Domain\Model\Lexeme, string, array, DerivativeContext)
#20 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(1714): Wikibase\Repo\Api\ModifyEntity->execute()
#21 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(684): ApiMain->executeAction()
#22 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(655): ApiMain->executeActionWithErrorHandling()
#23 /srv/mediawiki/php-1.37.0-wmf.9/api.php(90): ApiMain->execute()
#24 /srv/mediawiki/php-1.37.0-wmf.9/api.php(45): wfApiMain()
#25 /srv/mediawiki/w/api.php(3): require(string)
#26 {main}
exception.previous.trace
from /srv/mediawiki/php-1.37.0-wmf.9/extensions/WikibaseLexeme/src/Domain/Model/Lexeme.php(232)
#0 /srv/mediawiki/php-1.37.0-wmf.9/extensions/WikibaseLexeme/src/Serialization/StorageLexemeSerializer.php(106): Wikibase\Lexeme\Domain\Model\Lexeme->getLexicalCategory()
#1 /srv/mediawiki/php-1.37.0-wmf.9/extensions/WikibaseLexeme/src/Serialization/StorageLexemeSerializer.php(80): Wikibase\Lexeme\Serialization\StorageLexemeSerializer->getSerialized(Wikibase\Lexeme\Domain\Model\Lexeme)
#2 /srv/mediawiki/php-1.37.0-wmf.9/vendor/serialization/serialization/src/Serializers/DispatchingSerializer.php(42): Wikibase\Lexeme\Serialization\StorageLexemeSerializer->serialize(Wikibase\Lexeme\Domain\Model\Lexeme)
#3 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/lib/includes/Store/EntityContentDataCodec.php(152): Serializers\DispatchingSerializer->serialize(Wikibase\Lexeme\Domain\Model\Lexeme)
#4 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Content/EntityContent.php(327): Wikibase\Lib\Store\EntityContentDataCodec->encodeEntity(Wikibase\Lexeme\Domain\Model\Lexeme, string)
#5 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/RepoHooks.php(648): Wikibase\Repo\Content\EntityContent->getTextForFilters()
#6 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(338): Wikibase\Repo\RepoHooks::onAbuseFilterContentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent, NULL)
#7 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#8 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/Hooks/AbuseFilterHookRunner.php(89): MediaWiki\HookContainer\HookContainer->run(string, array)
#9 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/TextExtractor.php(85): MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner->onAbuseFilter_contentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent, NULL)
#10 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/AbuseFilterHooks.php(76): MediaWiki\Extension\AbuseFilter\TextExtractor->contentToString(Wikibase\Lexeme\MediaWiki\Content\LexemeContent)
#11 /srv/mediawiki/php-1.37.0-wmf.9/extensions/AbuseFilter/includes/AbuseFilterHooks.php(45): MediaWiki\Extension\AbuseFilter\AbuseFilterHooks::filterEdit(DerivativeContext, User, Wikibase\Lexeme\MediaWiki\Content\LexemeContent, string, string)
#12 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\AbuseFilter\AbuseFilterHooks::onEditFilterMergedContent(DerivativeContext, Wikibase\Lexeme\MediaWiki\Content\LexemeContent, Status, string, User, boolean, string)
#13 /srv/mediawiki/php-1.37.0-wmf.9/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#14 /srv/mediawiki/php-1.37.0-wmf.9/includes/Hooks.php(137): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#15 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditFilterHookRunner.php(105): Hooks::run(string, array)
#16 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/StatsdTimeRecordingEditFilterHookRunner.php(47): Wikibase\Repo\EditEntity\MediawikiEditFilterHookRunner->run(Wikibase\Lexeme\Domain\Model\Lexeme, DerivativeContext, string)
#17 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php(723): Wikibase\Repo\EditEntity\StatsdTimeRecordingEditFilterHookRunner->run(Wikibase\Lexeme\Domain\Model\Lexeme, DerivativeContext, string)
#18 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php(77): Wikibase\Repo\EditEntity\MediawikiEditEntity->attemptSave(Wikibase\Lexeme\Domain\Model\Lexeme, string, integer, string, boolean, array)
#19 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php(392): Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEditEntity->attemptSave(Wikibase\Lexeme\Domain\Model\Lexeme, string, integer, string, NULL, array)
#20 /srv/mediawiki/php-1.37.0-wmf.9/extensions/Wikibase/repo/includes/Api/ModifyEntity.php(327): Wikibase\Repo\Api\EntitySavingHelper->attemptSaveEntity(Wikibase\Lexeme\Domain\Model\Lexeme, string, array, DerivativeContext)
#21 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(1714): Wikibase\Repo\Api\ModifyEntity->execute()
#22 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(684): ApiMain->executeAction()
#23 /srv/mediawiki/php-1.37.0-wmf.9/includes/api/ApiMain.php(655): ApiMain->executeActionWithErrorHandling()
#24 /srv/mediawiki/php-1.37.0-wmf.9/api.php(90): ApiMain->execute()
#25 /srv/mediawiki/php-1.37.0-wmf.9/api.php(45): wfApiMain()
#26 /srv/mediawiki/w/api.php(3): require(string)
#27 {main}

I assume the reason we haven’t spotted it as a production error before is that these broken requests are almost never made. (The API response is not an internal error, by the way, but a regular API usage error. This exception is only logged internally.)