{"record":{"id":"2795e7af0c32590f","repo":"flowable/flowable-engine","slug":"lock-with-name-lockname-does-not-exist","errorCode":null,"errorMessage":"Lock with name ${lockName} does not exist","messagePattern":"Lock with name (.+?) does not exist","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/cmd/ReleaseLockCmd.java","lineNumber":47,"sourceCode":"\n    public ReleaseLockCmd(String lockName, String engineType, boolean delete) {\n        this.lockName = lockName;\n        this.engineType = engineType;\n        this.delete = delete;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        PropertyEntityManager propertyEntityManager = commandContext.getEngineConfigurations().get(engineType).getPropertyEntityManager();\n        PropertyEntity property = propertyEntityManager.findById(lockName);\n        if (property != null) {\n            property.setValue(null);\n            if (delete) {\n                propertyEntityManager.delete(property);\n            }\n            return null;\n        } else {\n            throw new FlowableObjectNotFoundException(\"Lock with name \" + lockName + \" does not exist\");\n        }\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":51,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/cmd/ReleaseLockCmd.java#L29-L51","documentation":"ReleaseLockCmd deletes the lock row identified by lockName from the Flowable property table. If no property entity with that name exists (the lock is not held or was already released/expired), it throws FlowableObjectNotFoundException. This indicates the caller tried to release a lock the engine has no record of.","triggerScenarios":"Calling managementService.executeCommand(new ReleaseLockCmd(lockName, changeLogDelete)) when the lock name does not match any row in the property table — e.g. acquiring after the lock already expired, double release, or a typo in the lock name.","commonSituations":"Async executor lock management after a database was wiped or migrated; race conditions where two nodes attempt release; upgrading engine versions where lock property names changed; custom code releasing locks it never acquired.","solutions":["Verify the lock name matches exactly the one used with AcquireLockCmd (case and spelling).","Wrap the release in a check or catch FlowableObjectNotFoundException and treat a missing lock as already released.","Inspect the property table (e.g. ACT_GE_PROPERTY) to confirm the lock row exists before releasing."],"exampleFix":"// before\nmanagementService.executeCommand(new ReleaseLockCmd(\"async-executor-lock\", true));\n// after\ntry {\n    managementService.executeCommand(new ReleaseLockCmd(\"async-executor-lock\", true));\n} catch (FlowableObjectNotFoundException e) {\n    // lock no longer exists; nothing to release\n}","handlingStrategy":"try-catch","validationCode":"PropertyEntity lock = commandContext.getPropertyEntityManager().findById(lockName); if (lock != null) { /* safe to release */ }","typeGuard":null,"tryCatchPattern":"try { managementService.executeCommand(new ReleaseLockCmd(lockName, true)); } catch (FlowableObjectNotFoundException e) { log.info(\"Lock {} already gone; treating as released\", lockName); }","preventionTips":["Only release locks you acquired, using the exact same lock name string","Treat 'lock not found' as an idempotent success in release logic","Check the property table contents when debugging lock lifecycle issues"],"tags":["locking","entity-not-found","database"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}