Page MenuHomePhabricator

Recursive types seem to break system
Closed, ResolvedPublic

Description

So I am not sure what the issue is, but I tried to create Z8/Function, which has a key Z8K5 of type Z8 - and that leads to an infinite recursion which MediaWiki fortunately detects and breaks:

[5fc47c1f62b192b6759471ab] /wiki/ZObject:Z81 Error from line 141 of /var/www/html/includes/title/NamespaceInfo.php: Maximum function nesting level of '256' reached, aborting!

Here is how to repeat that: the following Type declaration works fine - let this be Z81.

{
"Z1K1": "Z2",
"Z2K1": "Z0",
"Z2K2": {
    "Z1K1": "Z4",
    "Z4K1": "Z81",
    "Z4K2": [
        {
            "Z1K1": "Z3",
            "Z3K1": "Z1",
            "Z3K2": "Z81K1",
            "Z3K3": {
                "Z1K1": "Z12",
                "Z12K1": [
                    {
                        "Z1K1": "Z11",
                        "Z11K1": "en",
                        "Z11K2": "test"
                    }
                ]
            }
        }
    ],
    "Z4K3": "Z30"
},
"Z2K3": {
    "Z1K1": "Z12",
    "Z12K1": [
        {
            "Z1K1": "Z11",
            "Z11K1": "en",
            "Z11K2": "Recursion test"
        }
    ]
}
}

If you change the Z3K1 of the key to some other type, e.g. Z6, all is fine. But if you change it to Z81, i.e. to itself, it seems to enter into an infinite recursion upon validation.

It seems to sometimes store the content, but after that, we can't edit that page anymore, nor look at the source, nor compare to the current revision, not even delete the page. (Which indicate that we might want to rethink our strategy to validation)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 4 2020, 9:12 PM
DVrandecic triaged this task as Medium priority.Sep 4 2020, 9:12 PM

So the "easy" fix for this is for ZKey to not insist on being pointed at a known-to-this-wiki key. Is that OK?

Change 627572 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/WikiLambda@master] ZKey: Avoid recursion by storing the reference not the type

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

DVrandecic raised the priority of this task from Medium to High.Sep 16 2020, 3:26 PM

Change 627572 merged by jenkins-bot:
[mediawiki/extensions/WikiLambda@master] ZKey: Avoid recursion by storing the reference not the type

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

Jdforrester-WMF closed this task as Resolved.Sep 16 2020, 4:42 PM