mailtoboggavarapu-coder opened a new pull request, #19741: URL: https://github.com/apache/hudi/pull/19741
### Describe the issue this Pull Request addresses In `BaseZookeeperBasedLockProvider.close()`, the `curatorFrameworkClient.close()` call is placed inside the same `try` block as `lock.release()`. If `lock.release()` throws an exception (e.g., due to a network disruption, a disappeared ZooKeeper node, or a session timeout), execution transfers immediately to the `catch` block and `curatorFrameworkClient.close()` is never reached. This leaves the `CuratorFramework` client's background threads running and the ZooKeeper session open until ZooKeeper's own session timeout expires (typically 30–60 seconds per session). In enterprise multi-writer Hudi deployments where multiple executors hold and release locks, accumulated leaked sessions can exhaust ZooKeeper's maximum connection limit, causing distributed locking to fail across the entire data platform. ### Summary and Changelog Fixed the `CuratorFramework` resource leak in `BaseZookeeperBasedLockProvider.close()` by separating the lock release from the client cleanup using a `try-catch-finally` structure, ensuring `curatorFrameworkClient.close()` is always called regardless of whether `lock.release()` succeeds or throws. - `BaseZookeeperBasedLockProvider.java`: Moved `curatorFrameworkClient.close()` from the `try` block into a `finally` block, guaranteeing cleanup on both normal and exceptional exit paths. ### Impact No public API or user-facing change. Prevents ZooKeeper session exhaustion in long-running multi-writer Hudi deployments when lock release fails during shutdown. ### Risk Level low — Single structural change to exception handling; no logic change to lock acquisition, release, or ZooKeeper interaction. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] Adequate tests were added if applicable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
