Dheeraj-1103 commented on issue #39710: URL: https://github.com/apache/beam/issues/39710#issuecomment-5248531478
I’d like to work on this if it’s still open for contribution. I’ve gone through all three call sites and here’s the fix I’d propose: Approach: Replace the consecutive unguarded cleanup statements with a pattern that attempts every cleanup step even if an earlier one throws, while preserving the first exception as the primary failure and attaching subsequent failures via Throwable.addSuppressed(). A plain nested try/finally would guarantee cleanup, but could change which exception is ultimately propagated. 1. HBaseReader.close() (HBaseIO.java) * Ensure scanner.close() is attempted. * If it throws, still attempt connection.close(). * Preserve the scanner exception as the primary failure and suppress any connection-close exception. * Clear the resource references regardless of whether close() succeeds. 2. HBaseWriterFn.tearDown() * Apply the same pattern to mutator.close() followed by connection.close(). * This is particularly important because BufferedMutator.close() can legitimately throw when its final flush fails. 3. HBaseRowMutationWriterFn.tearDown() * Ensure HBaseSharedConnection.close(configuration) executes even if table.close() throws. * This is the most important case because skipping the shared-connection release can leave the static connection-pool reference count permanently elevated. Tests I’d add: * First cleanup step throws → second cleanup step is still executed. * Both cleanup steps throw → first exception is propagated and the second appears in getSuppressed(). * Normal successful cleanup remains unchanged. * For HBaseRowMutationWriterFn, verify that the shared connection is released/refcount decremented even when table.close() fails. I noticed that #39711 and #39712 are already linked to this issue. Could a maintainer confirm their current status before I start? If either PR already covers the implementation and additional tests/review would be more useful, I’m happy to contribute there instead of duplicating the work. -- 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]
