apache/pulsar · error · RestException

${e.getMessage()}

Error message

${e.getMessage()}

What it means

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.

Source

Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/WorkerImpl.java:151

            try {
                if (authParams.getClientRole() == null || !worker().getAuthorizationService().isSuperUser(authParams)
                        .get(worker().getWorkerConfig().getMetadataStoreOperationTimeoutSeconds(), SECONDS)) {
                    log.error().attr("clientRole", authParams.getClientRole())

                            .attr("originalPrincipal", authParams.getOriginalPrincipal()).attr("action", action)

                            .log("Client with role [ ] and originalPrincipal [ ] is not authorized to");
                    throw new RestException(Status.UNAUTHORIZED, "Client is not authorized to perform operation");
                }
            } catch (ExecutionException | TimeoutException | InterruptedException e) {
                log.warn().attr("workerConfig", worker().getWorkerConfig().getMetadataStoreOperationTimeoutSeconds())

                        .attr("clientRole", authParams.getClientRole())

                        .attr("originalPrincipal", authParams.getOriginalPrincipal())

                        .log("Time-out sec while checking the role originalPrincipal is a super user role");
                throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
            }
        }
    }

    @Override
    public List<org.apache.pulsar.common.stats.Metrics> getWorkerMetrics(final AuthenticationParameters authParams) {
        if (!isWorkerServiceAvailable() || worker().getMetricsGenerator() == null) {
            throwUnavailableException();
        }
        throwIfNotSuperUser(authParams, "get worker stats");
        return worker().getMetricsGenerator().generate();
    }

    @Override
    public List<WorkerFunctionInstanceStats> getFunctionsMetrics(AuthenticationParameters authParams)
            throws IOException {
        if (!isWorkerServiceAvailable()) {
            throwUnavailableException();

View on GitHub (pinned to 820761864e)

Solutions

  1. Check metadata store health and connectivity; fix outages first
  2. Increase workerConfig metadataStoreOperationTimeoutSeconds if timeouts are marginal
  3. Inspect the message body for the wrapped cause (ExecutionException/Timeout details)
  4. Retry after the store recovers; ensure workers are not being interrupted at shutdown

Example fix

// before
workerConfig.setMetadataStoreOperationTimeoutSeconds(1); // too low under load
// after
workerConfig.setMetadataStoreOperationTimeoutSeconds(30);
Defensive patterns

Strategy: retry

Validate before calling

// pre-check metadata store reachability is not exposed via API; retry on 500 instead
// ensure the timeout budget is sane client-side
Duration timeout = Duration.ofSeconds(10);

Type guard

boolean isInfraFailure(PulsarAdminException e) {
    return e.getStatusCode() == 500; // auth-check infra failure, not a 401 denial
}

Try / catch

try {
    return admin.worker().getFunctionsMetrics();
} catch (PulsarAdminException e) {
    if (e.getStatusCode() == 500 && e.getMessage() != null
            && (e.getMessage().contains("TimeoutException") || e.getMessage().contains("ExecutionException"))) {
        // retry with backoff after metadata store recovery
    }
    throw e;
}

Prevention

When it happens

Trigger: Any super-user-only worker API call while the metadata store is slow or down, exceeding metadataStoreOperationTimeoutSeconds, or the authorization service future completes exceptionally.

Common situations: ZooKeeper/metadata store outage or high latency; metadataStoreOperationTimeoutSeconds set too low for a loaded cluster; thread interruption during shutdown; AuthorizationProvider throwing internally.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/5bc3b644082a69f9. Report an issue: GitHub.