[Bug] Zookeeper lock leaks after deleting the engine.
- Dominant language
- Scala
- Stars
- 2.4k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
### Search before asking
- [x] I have searched in the [issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no similar issues.
### Describe the bug
After deleting a Spark engine, the lock path for that engine is not removed. This causes accumulating znodes for the lock.
```shell
# create cluster cluster-20250610024214-ha03nplj
[zk: localhost:2181(CONNECTED) 5] ls /kyuubi_1.8.0-SNAPSHOT_GROUP_SPARK_SQL/group1/cluster-20250610024214-ha03nplj
[serviceUri=192.168.56.10:36601;version=1.8.0-SNAPSHOT;spark.driver.memory=10g;spark.executor.memory=10g;kyuubi.engine.id=spark-c58207333fd740ceab863ad5785790c6;kyuubi.engine.url=192.168.56.10:4040;refId=dd58a01c-77db-44e3-b02c-9ad99c254c39;sequence=0000000000]
[zk: localhost:2181(CONNECTED) 6] ls /kyuubi_1.8.0-SNAPSHOT_GROUP_SPARK_SQL_lock/group1/cluster-20250610024214-ha03nplj
[leases, locks]
# delete cluster cluster-20250610024214-ha03nplj
[zk: localhost:2181(CONNECTED) 7] ls /kyuubi_1.8.0-SNAPSHOT_GROUP_SPARK_SQL/group1/cluster-20250610024214-ha03nplj
[]
[zk: localhost:2181(CONNECTED) 8] ls /kyuubi_1.8.0-SNAPSHOT_GROUP_SPARK_SQL_lock/group1/cluster-20250610024214-ha03nplj
[leases, locks]
```
### Affects Version(s)
1.8.0
### Kyuubi Server Log Output
```logtalk
```
### Kyuubi Engine Log Output
```logtalk
```
### Kyuubi Server Configurations
```yaml
```
### Kyuubi Engine Configurations
```yaml
```
### Additional context
_No response_
### Are you willing to submit PR?
- [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [x] No. I cannot submit a PR at this time.
Contributor guide
Research direction
Reproduce the issue using the ZooKeeper paths and deletion sequence shown in the report. Trace the Spark engine deletion flow and the corresponding lock-path cleanup, then verify that deleting an engine removes its lock znodes and that repeated deletions do not leave accumulating paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala, spark
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100