You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScipWriter.close() / ScipOutputStream never closes the underlying OutputStream before Files.move(), leaking file descriptors and locking temp files on Windows #1066
In scip-aggregator, ScipWriter implements AutoCloseable and writes to a temporary file (tmp) via ScipOutputStream(new BufferedOutputStream(Files.newOutputStream(tmp))), then moves tmp to options.output() in ScipWriter.build().
However, ScipWriter.close() only calls output.flush(), and ScipOutputStream has no close() method at all. The underlying OutputStream to tmp is never closed before Files.move(tmp, options.output(), StandardCopyOption.REPLACE_EXISTING) runs.
scip-aggregator/src/main/java/org/scip_code/scip_java/aggregator/ScipOutputStream.java (lines 9–36):
Wraps private final OutputStream out; and exposes write(...) and flush(), but does not implement AutoCloseable or provide a close() method.
Impact
Windows (win32) file lock failures: When ScipWriter.build() calls Files.move(tmp, options.output(), StandardCopyOption.REPLACE_EXISTING) while the OutputStream handle on tmp is still open — especially when %TEMP% (e.g. C:\Users\...\AppData\Local\Temp) and --output (e.g. D:\workspace\index.scip or another mount/volume) are on different drives, forcing Files.move to copy + Files.delete(tmp) — Windows fails with:
java.nio.file.FileSystemException: <tmp> -> <output>: The process cannot access the file because it is being used by another process
Resource leak on all platforms: Every ScipWriter instance leaks an open file descriptor until GC/process exit.
Activity