Page MenuHomePhabricator

Result of a function call is sometimes not there
Open, In Progress, HighPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?: Under "result", is says running, then it disappears without showing an actual result

What should have happened instead?: It should have shown the result there and the details

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.): Browser is Firefox

Event Timeline

Jdforrester-WMF subscribed.

I see an "Uncaught promise" when executing; malformed response triggering bad behaviour in the function evaluator widget? Whatever happens, we should show "something went wrong" rather than just die. :-)

I found a simpler place where the same behavior can be observed:
https://www.wikifunctions.org/view/en/Z10174

Can also be seen on the one connected implementation:
https://www.wikifunctions.org/view/en/Z11223

I get the following error message when clicking Run function:

TypeError: Cannot read properties of undefined (reading 'Z1K1')
    at Proxy.typeToString (typeUtils.js:160:55)
    at Proxy.type (ZObjectKeyValue.vue:339:17)
    at ue.fn (vue.js:7:14050)
    at ue.run (vue.js:7:6593)
    at get value (vue.js:7:14297)
    at Object.get [as type] (vue.js:9:5772)
    at Object.get (vue.js:9:3863)
    at Proxy.hasExpandedMode (ZObjectKeyValue.vue:395:13)
    at ue.fn (vue.js:7:14050)
    at ue.run (vue.js:7:6593)

I don't know if this is the same error as above or as on T360331 but it sure looks the same.

DVrandecic raised the priority of this task from Medium to High.Wed, Jun 26, 6:41 PM

I am not seeing that behavior on the implementation of and, just the function.

Oh, weird. Indeed, can confirm, I cannot see it on the implementation Z11223 anymore.

The object returned by the orchestrator has no Z22K1, which is causing the front-end to crash as it expects the key to be always present in a Z22.

This is the response of calling the Z10174/And function, returning "Service unavailable" in a badly formed Z22:

{
    "query": {
        "wikilambda_function_call": {
            "data": {
                "Z1K1": "Z22",
                "Z22K2": {
                    "Z1K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z883",
                        "Z883K1": "Z6",
                        "Z883K2": "Z1"
                    },
                    "K1": [
                        {
                            "Z1K1": "Z7",
                            "Z7K1": "Z882",
                            "Z882K1": "Z6",
                            "Z882K2": "Z1"
                        },
                        {
                            "Z1K1": {
                                "Z1K1": "Z7",
                                "Z7K1": "Z882",
                                "Z882K1": "Z6",
                                "Z882K2": "Z1"
                            },
                            "K1": "errors",
                            "K2": {
                                "Z1K1": "Z5",
                                "Z5K1": "Z507",
                                "Z5K2": {
                                    "Z1K1": {
                                        "Z1K1": "Z7",
                                        "Z7K1": "Z885",
                                        "Z885K1": "Z507"
                                    },
                                    "K1": {
                                        "Z1K1": "Z99",
                                        "Z99K1": {
                                            "Z1K1": "Z7",
                                            "Z7K1": "Z10174",
                                            "Z10174K1": {
                                                "Z1K1": "Z40",
                                                "Z40K1": "Z41"
                                            },
                                            "Z10174K2": {
                                                "Z1K1": "Z40",
                                                "Z40K1": "Z41"
                                            }
                                        }
                                    },
                                    "K2": {
                                        "Z1K1": "Z5",
                                        "Z5K1": "Z500",
                                        "Z5K2": {
                                            "Z1K1": {
                                                "Z1K1": "Z7",
                                                "Z7K1": "Z885",
                                                "Z885K1": "Z500"
                                            },
                                            "K1": "Service Unavailable"
                                        }
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
}

Sometimes the issue is "Service unavailable" and sometimes "Gateway timeout", like this response from Z17225/Quoted value by key:

{
    "query": {
        "wikilambda_function_call": {
            "data": {
                "Z1K1": "Z22",
                "Z22K2": {
                    "Z1K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z883",
                        "Z883K1": "Z6",
                        "Z883K2": "Z1"
                    },
                    "K1": [
                        {
                            "Z1K1": "Z7",
                            "Z7K1": "Z882",
                            "Z882K1": "Z6",
                            "Z882K2": "Z1"
                        },
                        {
                            "Z1K1": {
                                "Z1K1": "Z7",
                                "Z7K1": "Z882",
                                "Z882K1": "Z6",
                                "Z882K2": "Z1"
                            },
                            "K1": "errors",
                            "K2": {
                                "Z1K1": "Z5",
                                "Z5K1": "Z507",
                                "Z5K2": {
                                    "Z1K1": {
                                        "Z1K1": "Z7",
                                        "Z7K1": "Z885",
                                        "Z885K1": "Z507"
                                    },
                                    "K1": {
                                        "Z1K1": "Z99",
                                        "Z99K1": {
                                            "Z1K1": "Z7",
                                            "Z7K1": "Z17225",
                                            "Z17225K1": "something",
                                            "Z17225K2": {
                                                "Z1K1": "Z39",
                                                "Z39K1": "Z10000K1"
                                            }
                                        }
                                    },
                                    "K2": {
                                        "Z1K1": "Z5",
                                        "Z5K1": "Z500",
                                        "Z5K2": {
                                            "Z1K1": {
                                                "Z1K1": "Z7",
                                                "Z7K1": "Z885",
                                                "Z885K1": "Z500"
                                            },
                                            "K1": "Gateway Timeout"
                                        }
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
}

Another abnormality detected in the nestedMetadata key.
When running the wikilambda_perform_test API, the metadata returned for each test-implementation run contains a "Z24" as an extra item in the child nested metadata set:

See, below, the nestedMetadata key, which contains a map with three items. The first two are valid sets with a zObjectKey key each. The third item is Z24.

{
    "Z1K1": {
        "Z1K1": "Z7",
        "Z7K1": "Z883",
        "Z883K1": "Z6",
        "Z883K2": "Z1"
    },
    "K1": [
        {
            "Z1K1": "Z7",
            "Z7K1": "Z882",
            "Z882K1": "Z6",
            "Z882K2": "Z1"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "implementationId",
            "K2": {
                "Z1K1": "Z6",
                "Z6K1": "Z901"
            }
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "implementationType",
            "K2": "Z14K4"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "nestedMetadata",
            "K2": [
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z883",
                    "Z883K1": "Z6",
                    "Z883K2": "Z1"
                },
                {
                    "Z1K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z883",
                        "Z883K1": "Z6",
                        "Z883K2": "Z1"
                    },
                    "K1": [
                        {
                            "Z1K1": "Z7",
                            "Z7K1": "Z882",
                            "Z882K1": "Z6",
                            "Z882K2": "Z1"
                        },
                        {
                            "Z1K1": {
                                "Z1K1": "Z7",
                                "Z7K1": "Z882",
                                "Z882K1": "Z6",
                                "Z882K2": "Z1"
                            },
                            "K1": "zObjectKey",
                            "K2": "Z881(Z17)"
                        }
                    ]
                },
                {
                    "Z1K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z883",
                        "Z883K1": "Z6",
                        "Z883K2": "Z1"
                    },
                    "K1": [
                        {
                            "Z1K1": "Z7",
                            "Z7K1": "Z882",
                            "Z882K1": "Z6",
                            "Z882K2": "Z1"
                        },
                        {
                            "Z1K1": {
                                "Z1K1": "Z7",
                                "Z7K1": "Z882",
                                "Z882K1": "Z6",
                                "Z882K2": "Z1"
                            },
                            "K1": "zObjectKey",
                            "K2": "Z881(Z17)"
                        }
                    ]
                },
                "Z24"
            ]
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "zObjectKey",
            "K2": "null(Z6{\"Z6K1\":\"testing Test\"})"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationMemoryUsage",
            "K2": "80.8 MiB"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationCpuUsage",
            "K2": "85.102 ms"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationStartTime",
            "K2": "2024-06-27T08:52:56.247Z"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationEndTime",
            "K2": "2024-06-27T08:52:56.326Z"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationDuration",
            "K2": "79 ms"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "orchestrationHostname",
            "K2": "2770f1e79d24"
        },
        {
            "Z1K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z882",
                "Z882K1": "Z6",
                "Z882K2": "Z1"
            },
            "K1": "loadedFromMediaWikiCache",
            "K2": "2024-06-27T14:03:08Z"
        }
    ]
}

Another abnormality in the function_call returned object:

Normally, the data returned under query.wikilambda_function_call.data is a string encoded JSON. This is the expected response.
However, with some failed executions, the data returned under query.wikilambda_function_call.data is a parsed JSON object.

E.g. Try "Z17225/Quoted value by key" with filled input values. Returns a badly formed Gateway Timeout:

{
    "query": {
        "wikilambda_function_call": {
            "data": {
                "Z1K1": "Z22",
                "Z22K2": {
                    "Z1K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z883",
                        "Z883K1": "Z6",
                        "Z883K2": "Z1"
                    },
                    "K1": [
                        {
                            "Z1K1": "Z7",
                            "Z7K1": "Z882",
                            "Z882K1": "Z6",
                            "Z882K2": "Z1"
                        },
                        {
                            "Z1K1": {
                                "Z1K1": "Z7",
                                "Z7K1": "Z882",
                                "Z882K1": "Z6",
                                "Z882K2": "Z1"
                            },
                            "K1": "errors",
                            "K2": {
                                "Z1K1": "Z5",
                                "Z5K1": "Z507",
                                "Z5K2": {
                                    "Z1K1": {
                                        "Z1K1": "Z7",
                                        "Z7K1": "Z885",
                                        "Z885K1": "Z507"
                                    },
                                    "K1": {
                                        "Z1K1": "Z99",
                                        "Z99K1": {
                                            "Z1K1": "Z7",
                                            "Z7K1": "Z17225",
                                            "Z17225K1": "5",
                                            "Z17225K2": {
                                                "Z1K1": "Z39",
                                                "Z39K1": "Z5K2"
                                            }
                                        }
                                    },
                                    "K2": {
                                        "Z1K1": "Z5",
                                        "Z5K1": "Z500",
                                        "Z5K2": {
                                            "Z1K1": {
                                                "Z1K1": "Z7",
                                                "Z7K1": "Z885",
                                                "Z885K1": "Z500"
                                            },
                                            "K1": "Gateway Timeout"
                                        }
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
}

While sometimes, the data returned under query.wikilambda_function_call.data is a string that must be parsed as JSON. This is the expected response:

E.g. Try "Z17225/Quoted value by key" with empty input values, returns a correctly formed response and Z22, even if the execution wasn't successful.

{
    "query": {
        "wikilambda_function_call": {
            "success": "",
            "data": "{\"Z1K1\":\"Z22\",\"Z22K1\":\"Z24\",\"Z22K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z883\",\"Z883K1\":\"Z6\",\"Z883K2\":\"Z1\"},\"K1\":[{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"errors\",\"K2\":{\"Z1K1\":\"Z5\",\"Z5K1\":\"Z518\",\"Z5K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z885\",\"Z885K1\":\"Z518\"},\"Z518K1\":\"Z7\",\"Z518K2\":{\"Z1K1\":\"Z99\",\"Z99K1\":{\"Z1K1\":{\"Z1K1\":\"Z9\",\"Z9K1\":\"Z7\"},\"Z7K1\":{\"Z1K1\":\"Z9\",\"Z9K1\":\"Z17225\"},\"Z17225K1\":{\"Z1K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}},\"Z17225K2\":{\"Z1K1\":{\"Z1K1\":\"Z9\",\"Z9K1\":\"Z39\"},\"Z39K1\":{\"Z1K1\":\"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"},\"Z535K1\":{\"Z1K1\":\"Z99\",\"Z99K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}}}}]}}}},{\"Z1K1\":\"Z5\",\"Z5K1\":\"Z532\",\"Z5K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z885\",\"Z885K1\":\"Z532\"},\"Z532K1\":{\"Z1K1\":\"Z99\",\"Z99K1\":{\"Z1K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}}}}},{\"Z1K1\":\"Z5\",\"Z5K1\":\"Z535\",\"Z5K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z885\",\"Z885K1\":\"Z535\"},\"Z535K1\":{\"Z1K1\":\"Z99\",\"Z99K1\":{\"Z1K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}}}}},{\"Z1K1\":\"Z5\",\"Z5K1\":\"Z511\",\"Z5K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z885\",\"Z885K1\":\"Z511\"},\"Z511K1\":{\"Z1K1\":\"Z39\",\"Z39K1\":\"Z18K1\"},\"Z511K2\":{\"Z1K1\":\"Z99\",\"Z99K1\":{\"Z1K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}}}}}]}}}}}}}}},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationMemoryUsage\",\"K2\":\"82.08 MiB\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationCpuUsage\",\"K2\":\"7.137 ms\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationStartTime\",\"K2\":\"2024-06-26T13:00:45.634Z\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationEndTime\",\"K2\":\"2024-06-26T13:00:45.642Z\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationDuration\",\"K2\":\"8 ms\"},{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z882\",\"Z882K1\":\"Z6\",\"Z882K2\":\"Z1\"},\"K1\":\"orchestrationHostname\",\"K2\":\"function-orchestrator-main-orchestrator-75fc46f868-grzvw\"}]}}"
        }
    }
}

Change #1050611 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Fix response envelope format when API catches ClientException or ServerException

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

The issues described in comments T368531#9929498 and T368531#9934302 are caused in the WikiLambda API layer.

Patch 1050611 addresses correct ZResponseEnvelope initialization and addition into the response when there's a Client/Server exception caught.

Change #1050611 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix response envelope format when API catches ClientException or ServerException

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