{"record":{"id":"04d1e11310aa5da4","repo":"alibaba/nacos","slug":"oidc-discovery-interrupted","errorCode":null,"errorMessage":"OIDC discovery interrupted","messagePattern":"OIDC discovery interrupted","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"warning","filePath":"plugin-default-impl/nacos-oidc-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/oidc/config/OidcProviderMetadataProvider.java","lineNumber":112,"sourceCode":"            if (response.statusCode() != OidcProtocolConstants.HTTP_STATUS_OK) {\n                throw new IOException(\"Failed to discover OIDC configuration, status: \"\n                    + response.statusCode());\n            }\n            Map<String, Object> values = JsonUtils.toObj(response.body(), Map.class);\n            if (values == null) {\n                throw new IOException(\"OIDC discovery response is empty\");\n            }\n            OidcProviderMetadata result = new OidcProviderMetadata(\n                stringValue(values, OidcProtocolConstants.DISCOVERY_AUTHORIZATION_ENDPOINT),\n                stringValue(values, OidcProtocolConstants.DISCOVERY_TOKEN_ENDPOINT),\n                stringValue(values, OidcProtocolConstants.DISCOVERY_USERINFO_ENDPOINT),\n                stringValue(values, OidcProtocolConstants.DISCOVERY_END_SESSION_ENDPOINT),\n                stringValue(values, OidcProtocolConstants.DISCOVERY_JWKS_URI));\n            LOGGER.info(\"OIDC configuration discovered: jwksUri={}\", result.getJwksUri());\n            return result;\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new IOException(\"OIDC discovery interrupted\", e);\n        } catch (IOException e) {\n            throw e;\n        } catch (RuntimeException e) {\n            throw new IOException(\"Failed to parse OIDC configuration\", e);\n        }\n    }\n    \n    private String stringValue(Map<String, Object> values, String key) {\n        Object value = values.get(key);\n        return value == null ? null : value.toString();\n    }\n    \n    private String trimTrailingSlash(String value) {\n        int end = value.length();\n        while (end > 0 && value.charAt(end - 1) == '/') {\n            end--;\n        }\n        return value.substring(0, end);","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-oidc-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/oidc/config/OidcProviderMetadataProvider.java#L94-L130","documentation":"Thrown when the thread was interrupted during the blocking HTTP discovery call (httpClient.send). The interrupt flag is re-set before throwing. This is a thread-lifecycle/shutdown condition, not a normal request error.","triggerScenarios":"The thread performing discovery is interrupted while httpClient.send blocks — typically during application shutdown, a forced thread-pool shutdown, or a timeout-driven interrupt.","commonSituations":"Server shutting down during the first login request; thread pool interrupted; long discovery latency combined with an aggressive interrupt.","solutions":["Treat as transient: retry the operation on a non-interrupted thread (e.g. the next login attempt re-runs discovery).","If it recurs on shutdown, it is benign — the server is stopping.","If it recurs at runtime, check for code incorrectly interrupting the discovery thread.","Ensure the IdP responds within the 5-second discovery timeout to avoid external interrupt-like behavior."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    metadataProvider.getMetadata();\n} catch (IOException e) {\n    if (\"OIDC discovery interrupted\".equals(e.getMessage())) {\n        // transient thread interruption — retry once on a fresh path\n        if (!Thread.currentThread().isInterrupted()) {\n            metadataProvider.getMetadata();\n        }\n    } else {\n        throw e;\n    }\n}","preventionTips":["Do not interrupt threads performing discovery unless shutting down.","Treat interrupted discovery as transient; the lazy cache retries on next access.","During shutdown, log and suppress this error."],"tags":["oidc","network","threading","discovery"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}