{"record":{"id":"5bc3b644082a69f9","repo":"apache/pulsar","slug":"e-getmessage-5bc3b6","errorCode":null,"errorMessage":"${e.getMessage()}","messagePattern":"\\$\\{e\\.getMessage\\(\\)\\}","errorType":"http","errorClass":"RestException","httpStatus":500,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/WorkerImpl.java","lineNumber":151,"sourceCode":"            try {\n                if (authParams.getClientRole() == null || !worker().getAuthorizationService().isSuperUser(authParams)\n                        .get(worker().getWorkerConfig().getMetadataStoreOperationTimeoutSeconds(), SECONDS)) {\n                    log.error().attr(\"clientRole\", authParams.getClientRole())\n\n                            .attr(\"originalPrincipal\", authParams.getOriginalPrincipal()).attr(\"action\", action)\n\n                            .log(\"Client with role [ ] and originalPrincipal [ ] is not authorized to\");\n                    throw new RestException(Status.UNAUTHORIZED, \"Client is not authorized to perform operation\");\n                }\n            } catch (ExecutionException | TimeoutException | InterruptedException e) {\n                log.warn().attr(\"workerConfig\", worker().getWorkerConfig().getMetadataStoreOperationTimeoutSeconds())\n\n                        .attr(\"clientRole\", authParams.getClientRole())\n\n                        .attr(\"originalPrincipal\", authParams.getOriginalPrincipal())\n\n                        .log(\"Time-out sec while checking the role originalPrincipal is a super user role\");\n                throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());\n            }\n        }\n    }\n\n    @Override\n    public List<org.apache.pulsar.common.stats.Metrics> getWorkerMetrics(final AuthenticationParameters authParams) {\n        if (!isWorkerServiceAvailable() || worker().getMetricsGenerator() == null) {\n            throwUnavailableException();\n        }\n        throwIfNotSuperUser(authParams, \"get worker stats\");\n        return worker().getMetricsGenerator().generate();\n    }\n\n    @Override\n    public List<WorkerFunctionInstanceStats> getFunctionsMetrics(AuthenticationParameters authParams)\n            throws IOException {\n        if (!isWorkerServiceAvailable()) {\n            throwUnavailableException();","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/WorkerImpl.java#L133-L169","documentation":"When the super-user authorization check itself fails (ExecutionException, TimeoutException, or InterruptedException against the metadata store-backed authorization service), throwIfNotSuperUser rethrows the cause message as a 500 RestException. This is an infrastructure failure, not an authorization denial.","triggerScenarios":"Any super-user-only worker API call while the metadata store is slow or down, exceeding metadataStoreOperationTimeoutSeconds, or the authorization service future completes exceptionally.","commonSituations":"ZooKeeper/metadata store outage or high latency; metadataStoreOperationTimeoutSeconds set too low for a loaded cluster; thread interruption during shutdown; AuthorizationProvider throwing internally.","solutions":["Check metadata store health and connectivity; fix outages first","Increase workerConfig metadataStoreOperationTimeoutSeconds if timeouts are marginal","Inspect the message body for the wrapped cause (ExecutionException/Timeout details)","Retry after the store recovers; ensure workers are not being interrupted at shutdown"],"exampleFix":"// before\nworkerConfig.setMetadataStoreOperationTimeoutSeconds(1); // too low under load\n// after\nworkerConfig.setMetadataStoreOperationTimeoutSeconds(30);","handlingStrategy":"retry","validationCode":"// pre-check metadata store reachability is not exposed via API; retry on 500 instead\n// ensure the timeout budget is sane client-side\nDuration timeout = Duration.ofSeconds(10);","typeGuard":"boolean isInfraFailure(PulsarAdminException e) {\n    return e.getStatusCode() == 500; // auth-check infra failure, not a 401 denial\n}","tryCatchPattern":"try {\n    return admin.worker().getFunctionsMetrics();\n} catch (PulsarAdminException e) {\n    if (e.getStatusCode() == 500 && e.getMessage() != null\n            && (e.getMessage().contains(\"TimeoutException\") || e.getMessage().contains(\"ExecutionException\"))) {\n        // retry with backoff after metadata store recovery\n    }\n    throw e;\n}","preventionTips":["Set metadataStoreOperationTimeoutSeconds generously relative to store latency","Monitor metadata store health and alert before workers time out","Avoid shutting down/interrupting workers while admin calls are in flight","Distinguish 500 (infra) from 401 (denial) in client retry logic"],"tags":["pulsar-functions","metadata-store","timeout","authorization"],"backgroundTag":"metadata-store-timeout","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}