The GitHub Actions job "Check License" on fluss.git/fix/filelock-resource-leak 
has failed.
Run started by GitHub user XuQianJin-Stars (triggered by XuQianJin-Stars).

Head commit for run:
6a62af0098cd2c87d06f1a25a5b49f2010d2fbf6 / forwardxu <[email protected]>
[common] Fix resource leak and silenced exceptions in FileLock

FileLock#tryLock() previously caught every Exception and returned false, which 
had two issues: (1) genuine I/O failures were indistinguishable from 
inter-process lock contention, hiding real problems from callers, and (2) when 
the lock acquisition failed after init() had opened the FileOutputStream, the 
stream was never closed, leaking the underlying file descriptor for the 
lifetime of the JVM.

FileLock#unlockAndDestroy() also chained the channel close and stream close in 
a single try block; if closing the channel threw, the FileOutputStream was 
never closed.

This change:

  * Catches OverlappingFileLockException explicitly to keep the documented 
"return false on contention" semantics, but propagates IOException / 
RuntimeException so callers can react to real failures.

  * Closes the FileOutputStream when tryLock() fails after init(), preventing 
the descriptor leak.

  * Reworks unlockAndDestroy() with nested try-finally blocks so the output 
stream is always closed even when releasing or closing the channel throws.

  * Adds FileLockTest covering the happy path, in-JVM contention, reuse after 
unlockAndDestroy(), destroy without acquisition, isValid() before tryLock(), 
and the constructor's rejection of file names with no legal characters.

Report URL: https://github.com/apache/fluss/actions/runs/26348535715

With regards,
GitHub Actions via GitBox

Reply via email to