Bharathi-Kanna opened a new pull request, #16278: URL: https://github.com/apache/lucene/pull/16278
### Description When lock acquisition fails in `NativeFSLockFactory.obtainFSLock`, the `FileChannel` is closed inside a `finally` block using `IOUtils.closeWhileHandlingException(channel)`. There was a `// TODO: addSuppressed` comment indicating that any exception during closure should be attached to the original failure — but this was never implemented, silently swallowing close exceptions. **Changes:** - Replace the `finally` block with `catch (Throwable t)` to properly capture the original exception - Use `IOUtils.closeWhileSuppressingExceptions(t, channel)` to attach close failures as suppressed exceptions - Wrap `clearLockHeld(realPath)` in a try-catch so cleanup failures are also suppressed rather than masking the original error - Add `testSuppressedExceptionOnLockFailure` test using a mock filesystem that fails both `tryLock()` and `close()` - Add `CHANGES.txt` entry under Lucene 11.0.0 Bug Fixes **Why this matters:** Without this fix, if a lock acquisition fails *and* the subsequent `channel.close()` also fails (e.g., due to file handle exhaustion or filesystem errors), the close exception is silently lost. This makes debugging production issues significantly harder. With this fix, all secondary failures are preserved in the exception chain via `getSuppressed()`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
