waterWang opened a new pull request, #39711: URL: https://github.com/apache/beam/pull/39711
Fixes #39710 ## What `HBaseIO` releases its resources as consecutive, unguarded statements in three teardown paths. If an earlier `close()` throws, everything after it is skipped: 1. **`HBaseReader.close()`** — a throwing `scanner.close()` leaks the `Connection`. 2. **`HBaseWriterFn.tearDown()`** — `BufferedMutator.close()` is documented to throw on a final flush failure (down region server, network blip), so a failed flush skips `connection.close()`, leaking the whole per-`@Setup` Connection. 3. **`HBaseRowMutationWriterFn.tearDown()`** — worst case: a throwing `table.close()` skips `HBaseSharedConnection.close(configuration)`, which is a reference-count decrement. Because the pool is a `static HashMap`, the leaked entry (and its ZooKeeper session / RPC threads) survives for the JVM lifetime and every later `getOrCreate` hands back the same permanently-unreleasable connection. ## Fix Wrap each cleanup step in `try/finally` so every step runs unconditionally, while preserving the **first** failure and attaching later ones with `addSuppressed`, so callers still see the error that actually broke the job rather than a teardown symptom. - `HBaseReader.close()`: connection is now always closed even if `scanner.close()` throws. - `HBaseWriterFn.tearDown()`: `connection.close()` always runs even if `mutator.close()` throws. - `HBaseRowMutationWriterFn.tearDown()`: `HBaseSharedConnection.close(configuration)` (the refcount decrement) always runs even if `table.close()` throws. ## Testing Existing tests in `sdks/java/io/hbase/src/test/java/org/apache/beam/sdk/io/hbase/` cover the read and write paths; the change is purely control-flow (guarding cleanup), so no new behavior is introduced when nothing throws. -- 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]
