{"record":{"id":"fb194bf7978703ab","repo":"apache/pulsar","slug":"timeout-during-update-managedledger-s-properties","errorCode":null,"errorMessage":"Timeout during update managedLedger's properties","messagePattern":"Timeout during update managedLedger's properties","errorType":"exception","errorClass":"ManagedLedgerException","httpStatus":null,"severity":"error","filePath":"managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java","lineNumber":4924,"sourceCode":"        class Result {\n            ManagedLedgerException exception = null;\n        }\n        final Result result = new Result();\n        this.asyncUpdateProperties(properties, isDelete, deleteKey, new UpdatePropertiesCallback() {\n            @Override\n            public void updatePropertiesComplete(Map<String, String> properties, Object ctx) {\n                latch.countDown();\n            }\n\n            @Override\n            public void updatePropertiesFailed(ManagedLedgerException exception, Object ctx) {\n                result.exception = exception;\n                latch.countDown();\n            }\n        }, null);\n\n        if (!latch.await(AsyncOperationTimeoutSeconds, TimeUnit.SECONDS)) {\n            throw new ManagedLedgerException(\"Timeout during update managedLedger's properties\");\n        }\n\n        if (result.exception != null) {\n            log.error().exception(result.exception).log(\"Update managedLedger's properties failed\");\n            throw result.exception;\n        }\n    }\n\n    private void asyncUpdateProperties(Map<String, String> properties, boolean isDelete,\n        String deleteKey, final UpdatePropertiesCallback callback, Object ctx) {\n        if (!metadataMutex.tryLock()) {\n            // Defer update for later\n            scheduledExecutor.schedule(() -> asyncUpdateProperties(properties, isDelete, deleteKey,\n                callback, ctx), 100, TimeUnit.MILLISECONDS);\n            return;\n        }\n        if (isDelete) {\n            propertiesMap.remove(deleteKey);","sourceCodeStart":4906,"sourceCodeEnd":4942,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L4906-L4942","documentation":"ManagedLedgerImpl.setProperty()/update-properties waits on a latch for the async metadata-store (ZooKeeper) update of the managed ledger's properties map. If the async update callback does not fire within AsyncOperationTimeoutSeconds, this ManagedLedgerException is thrown. The properties update may or may not have been persisted.","triggerScenarios":"Calling the synchronous setProperty()/updateProperties API while the metadata store is slow or disconnected — ZooKeeper session expiry, quorum loss, or large properties payload causing slow write.","commonSituations":"Admin updates of topic properties during a ZooKeeper outage or long GC pause on the broker; network partition between broker and metadata store.","solutions":["Check metadata-store (ZooKeeper) health and connectivity; the timeout usually reflects a store-side stall","Use the async updateProperties() variant so you aren't bound by the sync latch timeout","Retry the update after connectivity is restored and verify the persisted properties via getProperties()","Keep the properties payload small to avoid slow metadata writes"],"exampleFix":"// before\nml.setProperty(key, value); // sync latch, throws on ZK stall\n// after\nml.asyncSetProperty(key, value)\n  .thenAccept(v -> log.info(\"property updated\"))\n  .exceptionally(ex -> { log.warn(\"update failed, retrying\", ex); return null; });","handlingStrategy":"try-catch","validationCode":"if (!zkConnected) { deferPropertyUpdate(key, value); return; }","typeGuard":null,"tryCatchPattern":"try {\n    ml.setProperty(key, value);\n} catch (ManagedLedgerException e) {\n    log.warn(\"property update timed out; verify ZK then retry\", e);\n    retryWithBackoff(() -> ml.asyncSetProperty(key, value));\n}","preventionTips":["Check metadata-store health before property updates","Use async updateProperties() in admin tooling","Keep the properties map small","Read back properties after retry to confirm persistence"],"tags":["timeout","metadata","zookeeper","managed-ledger"],"backgroundTag":"async-operation-timeout","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"}