apache/dolphinscheduler · error · RegistryException

etcd release lock error, lockKey:

Error message

etcd release lock error, lockKey: 

What it means

Wrapper thrown in EtcdRegistry.releaseLock: any failure while releasing the etcd lock — the lease revoke RPC failing, connection errors, or the nested IllegalMonitorStateException from the negative-count guard — is caught and rethrown as a RegistryException keyed by the lockKey, so callers see one uniform error with the original cause attached.

Source

Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-etcd/src/main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdRegistry.java:404

            }
            LockEntry lockEntry = lockEntryMap.get(key);
            if (lockEntry == null) {
                return true;
            }
            int newLockCount = lockEntry.lockCount.decrementAndGet();
            if (newLockCount > 0) {
                return true;
            }
            if (newLockCount < 0) {
                throw new IllegalMonitorStateException("Etcd lock count has gone negative for lock: " + key);
            }
            client.getLeaseClient().revoke(lockEntry.leaseId);
            lockEntryMap.remove(key);
            if (lockEntryMap.isEmpty()) {
                threadLocalLockMap.remove();
            }
        } catch (Exception e) {
            throw new RegistryException("etcd release lock error, lockKey: " + key, e);
        }
        return true;
    }

    @Override
    public void close() throws IOException {
        // When the client closes, the watch also closes.
        client.close();
    }

    private static ByteSequence byteSequence(String val) {
        return ByteSequence.from(val, StandardCharsets.UTF_8);
    }

    private Event toEvent(final WatchEvent watchEvent, final String watchedPath) {
        Event.Type eventType = null;
        switch (watchEvent.getEventType()) {
            case PUT:

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the cause chain to distinguish lease-revoke RPC failure from lock-count misuse
  2. Check etcd connectivity and endpoint health if the cause is a gRPC/transport error
  3. Ensure balanced acquire/release per thread (negative lock count is guarded separately)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-etcd/src/main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdRegistry.java:404 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/df1367bbfc2e3b5f. Report an issue: GitHub.