apache/shenyu · error · ShenyuException

apollo client getItemValue time out

Error message

apollo client getItemValue time out

What it means

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.

Solutions

  1. Verify Apollo portal/server connectivity and address configuration (apollo.meta / portal URL).
  2. Retry the lookup; transient network latency often resolves.
  3. Increase any client-side HTTP read timeout for the Apollo open API.
  4. Check Apollo server logs and load; scale or restart the Apollo instance if it is degraded.

Example fix

// before
String value = apolloClient.getItemValue(key); // throws if key == "timeout"
// after
retry(() -> apolloClient.getItemValue(key), 3, backoff()); // retry transient timeouts
Defensive patterns

Strategy: retry

Validate before calling

// pre-check connectivity to Apollo portal before lookup
boolean reachable = ping(apolloPortalUrl, timeoutMs);

Type guard

null

Try / catch

try { return apolloClient.getItemValue(key); } catch (ShenyuException e) { if (e.getMessage().contains("time out")) { return retryWithBackoff(() -> apolloClient.getItemValue(key), 3); } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Apollo portal unreachable or slow, network latency between admin and Apollo server, Apollo server overloaded, or misconfigured Apollo meta/portal address causing slow requests.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/9f71e43824fb1979. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-admin-listener/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java:74

    /**
     * get item value.
     * @param key item key
     * @return item value
     */
    public String getItemValue(final String key) {
        OpenItemDTO openItemDTO = this.apolloOpenApiClient.getItem(
                apolloConfig.getAppId(),
                apolloConfig.getEnv(),
                apolloConfig.getClusterName(),
                apolloConfig.getNamespace(),
                key);
        if (Objects.isNull(openItemDTO)) {
            return null;
        }
        if (openItemDTO.getKey().equals("timeout")) {
            LOG.error("apollo client getItemValue time out");
            throw new ShenyuException("apollo client getItemValue time out");
        }
        return openItemDTO.getValue();
    }


    /**
     * removeItemKey.
     *
     * @param key key
     */
    public void removeItemKey(final String key) {
        this.apolloOpenApiClient.removeItem(
                apolloConfig.getAppId(),
                apolloConfig.getEnv(),
                apolloConfig.getClusterName(),
                apolloConfig.getNamespace(),
                key, operatorUser);
    }

View on GitHub (pinned to 567142e072)