Wikibase\DataModel\Entity\EntityIdParsingException $serialization must not be an empty string
Closed, ResolvedPublic

Description

Noticed at Fatal Monitor after pushing 1.32.0-wmf.14 to group 1.

[{exception_id}] {exception_url} Wikibase\DataModel\Entity\EntityIdParsingException from line 49 of /srv/mediawiki/php-1.32.0-wmf.14/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php: $serialization must not be an empty string

I have rolled back group 1 from .14 to .13, but now I see the same error for .13

[{exception_id}] {exception_url} Wikibase\DataModel\Entity\EntityIdParsingException from line 49 of /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php: $serialization must not be an empty string 

server: www.wikidata.org
method: POST
url: /w/api.php

exception_id: W1iQPQpAMDgAAB7gqzIAAAAD
exception.trace:

#0 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model/src/Entity/EntityId.php(89): Wikibase\DataModel\Entity\EntityId::assertValidSerialization(string)
#1 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php(45): Wikibase\DataModel\Entity\EntityId::splitSerialization(string)
#2 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/WikibaseRepo.php(1459): Wikibase\DataModel\Entity\DispatchingEntityIdParser->parse(string)
#3 /srv/mediawiki/php-1.32.0-wmf.13/vendor/data-values/serialization/src/Deserializers/DataValueDeserializer.php(122): Closure$Wikibase\Repo\WikibaseRepo::getDataValueDeserializer(array)
#4 /srv/mediawiki/php-1.32.0-wmf.13/vendor/data-values/serialization/src/Deserializers/DataValueDeserializer.php(91): DataValues\Deserializers\DataValueDeserializer->getDeserialization(array)
#5 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(118): DataValues\Deserializers\DataValueDeserializer->deserialize(array)
#6 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(108): Wikibase\DataModel\Deserializers\SnakDeserializer->deserializeDataValue(array)
#7 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(90): Wikibase\DataModel\Deserializers\SnakDeserializer->newValueSnak(array)
#8 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(72): Wikibase\DataModel\Deserializers\SnakDeserializer->getDeserialized(array)
#9 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php(110): Wikibase\DataModel\Deserializers\SnakDeserializer->deserialize(array)
#10 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php(100): Wikibase\DataModel\Deserializers\StatementDeserializer->getDeserialized(array)
#11 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/Api/SetClaim.php(191): Wikibase\DataModel\Deserializers\StatementDeserializer->deserialize(array)
#12 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/Api/SetClaim.php(109): Wikibase\Repo\Api\SetClaim->getStatementFromParams(array)
#13 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(1582): Wikibase\Repo\Api\SetClaim->execute()
#14 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(535): ApiMain->executeAction()
#15 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(506): ApiMain->executeActionWithErrorHandling()
#16 /srv/mediawiki/php-1.32.0-wmf.13/api.php(83): ApiMain->execute()
#17 /srv/mediawiki/w/api.php(3): include(string)
#18 {main}
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 25 2018, 2:27 PM
zeljkofilipin triaged this task as Unbreak Now! priority.
Restricted Application added subscribers: Liuxinyu970226, TerraCodes. · View Herald TranscriptJul 25 2018, 2:29 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptJul 25 2018, 2:30 PM
zeljkofilipin updated the task description. (Show Details)
zeljkofilipin renamed this task from [{exception_id}] {exception_url} Wikibase\DataModel\Entity\EntityIdParsingException from line 49 of /srv/mediawiki/php-1.32.0-wmf.14/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php: $serialization must not be an empty string to Wikibase\DataModel\Entity\EntityIdParsingException $serialization must not be an empty string.
zeljkofilipin updated the task description. (Show Details)

Change 447815 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[operations/mediawiki-config@master] Revert "group1 wikis to 1.32.0-wmf.14"

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

It's probably a new version that got released but not updated in the vendor I think.

Change 447815 merged by jenkins-bot:
[operations/mediawiki-config@master] Revert "group1 wikis to 1.32.0-wmf.14"

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

I have rolled back group 1 from .14 to .13, but now I see the same error for .13

[{exception_id}] {exception_url} Wikibase\DataModel\Entity\EntityIdParsingException from line 49 of /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php: $serialization must not be an empty string

It's probably a new version that got released but not updated in the vendor I think.

Is there a way to quickly fix this? Or is there a workaround? I need an estimate on when this could be resolved, since it's blocking the train, and we are already behind because of problems with .13. 😢

I looked at one of the stacktraces and it looks like this is coming from the API, so it could just be a client providing bad data:

#0 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/WikibaseRepo.php(1459): Wikibase\DataModel\Entity\DispatchingEntityIdParser->parse(string)
#1 /srv/mediawiki/php-1.32.0-wmf.13/vendor/data-values/serialization/src/Deserializers/DataValueDeserializer.php(122): Closure$Wikibase\Repo\WikibaseRepo::getDataValueDeserializer(array)
#2 /srv/mediawiki/php-1.32.0-wmf.13/vendor/data-values/serialization/src/Deserializers/DataValueDeserializer.php(91): DataValues\Deserializers\DataValueDeserializer->getDeserialization(array)
#3 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(118): DataValues\Deserializers\DataValueDeserializer->deserialize(array)
#4 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(108): Wikibase\DataModel\Deserializers\SnakDeserializer->deserializeDataValue(array)
#5 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(90): Wikibase\DataModel\Deserializers\SnakDeserializer->newValueSnak(array)
#6 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/SnakDeserializer.php(72): Wikibase\DataModel\Deserializers\SnakDeserializer->getDeserialized(array)
#7 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php(110): Wikibase\DataModel\Deserializers\SnakDeserializer->deserialize(array)
#8 /srv/mediawiki/php-1.32.0-wmf.13/vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php(100): Wikibase\DataModel\Deserializers\StatementDeserializer->getDeserialized(array)
#9 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/Api/SetClaim.php(191): Wikibase\DataModel\Deserializers\StatementDeserializer->deserialize(array)
#10 /srv/mediawiki/php-1.32.0-wmf.13/extensions/Wikibase/repo/includes/Api/SetClaim.php(109): Wikibase\Repo\Api\SetClaim->getStatementFromParams(array)
#11 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(1582): Wikibase\Repo\Api\SetClaim->execute()
#12 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(535): ApiMain->executeAction()
#13 /srv/mediawiki/php-1.32.0-wmf.13/includes/api/ApiMain.php(506): ApiMain->executeActionWithErrorHandling()
#14 /srv/mediawiki/php-1.32.0-wmf.13/api.php(83): ApiMain->execute()
#15 /srv/mediawiki/w/api.php(3): include(string)
#16 {main}
Krinkle updated the task description. (Show Details)Jul 25 2018, 3:06 PM

The SetClaim API module should catch the exception and report a nice error message instead of spamming the exception logs and sending the exception to the client..

@Addshore Given that the API end point did not change and the parser threw the exceptions all along it's probably valid to assume it's just the requests that changed - does that warrant this ticket to be downgraded?

Addshore lowered the priority of this task from Unbreak Now! to High.Jul 25 2018, 5:02 PM

Looks like the exceptions have stopped, downgrading to High, as we really should stop this ability to produce prod log spam

Addshore claimed this task.Jul 25 2018, 5:05 PM
Restricted Application added a project: User-Addshore. · View Herald TranscriptJul 25 2018, 5:05 PM

The issue is caused when the closure for 'wikibase-entityid' is called as provided by WikibasRepo::getDataValueDeserializer
This is called by DataValueDeserializer::getDeserialization which catches InvalidArgumentException but not EntityIdParsingExceptions which is actually what needs to be caught.
The InvalidArgumentException is caught and the EntityIdParsingException is then thrown from DispatchingEntityIdParser::parse

Change 447840 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] Catch EntityIdParsingException in SetClaim

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

Addshore added a comment.EditedJul 25 2018, 5:33 PM

Reproduction on test wikidata wiki:

{
    "mainsnak": {
        "snaktype": "value",
        "property": "P7",
        "hash": "481c0a0ccbe34a98f027fbdd5b202a54c98f3494",
        "datavalue": {
            "value": {
                "entity-type": "item",
                "numeric-id": 4288,
                "id": "QQ4288"
            },
            "type": "wikibase-entityid"
        },
        "datatype": "wikibase-item"
    },
    "type": "statement",
    "id": "Q70759$151fed00-42f6-4125-0316-736e56a12026",
    "rank": "normal"
}

DataValueDeserializer::__construct docs should be updated to say what types of exceptions the builders can throw.
A better fix (than the current gerrit patch) might actually be to catch the EntityIdParsingException in the closure in WikibaseRepo and return another InvalidArgumentException from there, this would be consistent with the other builders.
This would then be re caught in DataValueDeserializer::getDeserialization and rethrown as a DeserializationException which would be handled by SetClaim..

Change 447840 abandoned by Addshore:
Catch EntityIdParsingException in SetClaim

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

Addshore removed Addshore as the assignee of this task.Jul 25 2018, 5:43 PM

Change 448022 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] Make wikibase-entityid catch EntityIdParsingExceptions

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

Addshore moved this task from Backlog to Needs Review on the User-Addshore board.Jul 26 2018, 11:21 AM
Addshore moved this task from In Progress to Peer Review on the Wikidata-Campsite board.

Change 448022 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Make wikibase-entityid catch EntityIdParsingExceptions

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

Lydia_Pintscher closed this task as Resolved.Jul 28 2018, 1:19 PM
Lydia_Pintscher moved this task from Test (Verification) to Done on the Wikidata-Campsite board.