{"record":{"id":"04bbb342f59f7ec5","repo":"apache/pulsar","slug":"timeout-during-clear-backlog-operation","errorCode":null,"errorMessage":"Timeout during clear backlog operation","messagePattern":"Timeout during clear backlog operation","errorType":"exception","errorClass":"ManagedLedgerException","httpStatus":null,"severity":"error","filePath":"managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java","lineNumber":2008,"sourceCode":"\n        final Result result = new Result();\n        final CountDownLatch counter = new CountDownLatch(1);\n\n        asyncClearBacklog(new ClearBacklogCallback() {\n            @Override\n            public void clearBacklogComplete(Object ctx) {\n                counter.countDown();\n            }\n\n            @Override\n            public void clearBacklogFailed(ManagedLedgerException exception, Object ctx) {\n                result.exception = exception;\n                counter.countDown();\n            }\n        }, null);\n\n        if (!counter.await(ManagedLedgerImpl.AsyncOperationTimeoutSeconds, TimeUnit.SECONDS)) {\n            throw new ManagedLedgerException(\"Timeout during clear backlog operation\");\n        }\n\n        if (result.exception != null) {\n            throw result.exception;\n        }\n    }\n\n    @Override\n    public void asyncClearBacklog(final ClearBacklogCallback callback, Object ctx) {\n        asyncMarkDelete(ledger.getLastPosition(), new MarkDeleteCallback() {\n            @Override\n            public void markDeleteComplete(Object ctx) {\n                callback.clearBacklogComplete(ctx);\n            }\n\n            @Override\n            public void markDeleteFailed(ManagedLedgerException exception, Object ctx) {\n                if (exception.getCause() instanceof IllegalArgumentException) {","sourceCodeStart":1990,"sourceCodeEnd":2026,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java#L1990-L2026","documentation":"The Azure Blob offload provider obtains credentials from the environment variables AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY. buildCredentials throws IllegalArgumentException when AZURE_STORAGE_ACCOUNT is empty or unset, because no storage account name is available to build the Credentials object.","triggerScenarios":"Starting offload with driver=azureblob while the AZURE_STORAGE_ACCOUNT environment variable is not set in the broker/offloader process environment.","commonSituations":"Env var not exported in the systemd unit / Docker container / K8s deployment spec, variable set only in an interactive shell but not in the service environment, name typo (AZURE_STORAGE_ACCOUNT_NAME), or running the offloader on a different host than where the variable was configured.","solutions":["Set AZURE_STORAGE_ACCOUNT in the process environment of the broker/offloader before startup (export or deployment manifest env entry).","Also set AZURE_STORAGE_ACCESS_KEY, otherwise the next check will fail with the access-key error.","Verify with `tr '\\0' '\\n' < /proc/<broker-pid>/environ | grep AZURE` that the running process actually sees it.","Check spelling and casing of the variable name in your deployment configuration."],"exampleFix":"// before (docker-compose): env var missing\nbroker:\n  image: apachepulsar/pulsar\n\n// after:\nbroker:\n  image: apachepulsar/pulsar\n  environment:\n    - AZURE_STORAGE_ACCOUNT=mystorageacct\n    - AZURE_STORAGE_ACCESS_KEY=<base64-key>","handlingStrategy":"validation","validationCode":"if (System.getenv(\"AZURE_STORAGE_ACCOUNT\") == null || System.getenv(\"AZURE_STORAGE_ACCOUNT\").isEmpty()) {\n    throw new IllegalStateException(\"AZURE_STORAGE_ACCOUNT must be set for azureblob offload\");\n}\nif (System.getenv(\"AZURE_STORAGE_ACCESS_KEY\") == null || System.getenv(\"AZURE_STORAGE_ACCESS_KEY\").isEmpty()) {\n    throw new IllegalStateException(\"AZURE_STORAGE_ACCESS_KEY must be set for azureblob offload\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    provider.buildCredentials(tieringConfig);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"azure storage account\")) {\n        log.error(\"Set AZURE_STORAGE_ACCOUNT (and AZURE_STORAGE_ACCESS_KEY) in the broker process environment\");\n    }\n    throw e;\n}","preventionTips":["Export both AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY in the same service unit/container as the broker.","Check /proc/<pid>/environ to confirm the running process actually sees the variables.","Keep variable names exactly as documented (no AZURE_STORAGE_ACCOUNT_NAME variants).","Prefer managed identity to eliminate key-based env configuration."],"tags":["azure","configuration","env-var","credentials"],"backgroundTag":"missing-env-var","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}