{"record":{"id":"9f71e43824fb1979","repo":"apache/shenyu","slug":"apollo-client-getitemvalue-time-out","errorCode":null,"errorMessage":"apollo client getItemValue time out","messagePattern":"apollo client getItemValue time out","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-admin-listener/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java","lineNumber":74,"sourceCode":"\n    /**\n     * get item value.\n     * @param key item key\n     * @return item value\n     */\n    public String getItemValue(final String key) {\n        OpenItemDTO openItemDTO = this.apolloOpenApiClient.getItem(\n                apolloConfig.getAppId(),\n                apolloConfig.getEnv(),\n                apolloConfig.getClusterName(),\n                apolloConfig.getNamespace(),\n                key);\n        if (Objects.isNull(openItemDTO)) {\n            return null;\n        }\n        if (openItemDTO.getKey().equals(\"timeout\")) {\n            LOG.error(\"apollo client getItemValue time out\");\n            throw new ShenyuException(\"apollo client getItemValue time out\");\n        }\n        return openItemDTO.getValue();\n    }\n\n\n    /**\n     * removeItemKey.\n     *\n     * @param key key\n     */\n    public void removeItemKey(final String key) {\n        this.apolloOpenApiClient.removeItem(\n                apolloConfig.getAppId(),\n                apolloConfig.getEnv(),\n                apolloConfig.getClusterName(),\n                apolloConfig.getNamespace(),\n                key, operatorUser);\n    }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin-listener/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java#L56-L92","documentation":"ApolloClient.getItemValue fetches a configuration item from Apollo. When the fetched item's key equals \"timeout\" it is treated as a timeout signal and a ShenyuException is thrown rather than returning the value, indicating the Apollo lookup timed out.","triggerScenarios":"Calling ApolloClient.getItemValue(key) where the Apollo portal/open-API returns an OpenItemDTO whose key is literally \"timeout\" — i.e. the Apollo client request for the item timed out and that sentinel item is returned.","commonSituations":"Apollo portal unreachable or slow, network latency between admin and Apollo server, Apollo server overloaded, or misconfigured Apollo meta/portal address causing slow requests.","solutions":["Verify Apollo portal/server connectivity and address configuration (apollo.meta / portal URL).","Retry the lookup; transient network latency often resolves.","Increase any client-side HTTP read timeout for the Apollo open API.","Check Apollo server logs and load; scale or restart the Apollo instance if it is degraded."],"exampleFix":"// before\nString value = apolloClient.getItemValue(key); // throws if key == \"timeout\"\n// after\nretry(() -> apolloClient.getItemValue(key), 3, backoff()); // retry transient timeouts","handlingStrategy":"retry","validationCode":"// pre-check connectivity to Apollo portal before lookup\nboolean reachable = ping(apolloPortalUrl, timeoutMs);","typeGuard":"null","tryCatchPattern":"try { return apolloClient.getItemValue(key); } catch (ShenyuException e) { if (e.getMessage().contains(\"time out\")) { return retryWithBackoff(() -> apolloClient.getItemValue(key), 3); } throw e; }","preventionTips":["Monitor Apollo portal latency and alert on slow responses.","Place admin and Apollo in the same network zone to reduce RTT.","Set generous but bounded HTTP timeouts for the Apollo open API.","Cache successfully fetched item values to tolerate transient outages."],"tags":["apollo","timeout","config-sync"],"backgroundTag":"request-timeout","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}