-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazel server: ensure file streams are closed #5512
Labels
Comments
bazel-io
pushed a commit
that referenced
this issue
Jul 5, 2018
Use try-with-resources to ensure InputStreams that we open via FileSystem.InputStream(path) are closed. Eagerly closing InputStreams avoids hanging on to file handles until the garbage collector finalizes the InputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See #5512 RELNOTES: none PiperOrigin-RevId: 203338148
bazel-io
pushed a commit
that referenced
this issue
Jul 5, 2018
Use try-with-resources to ensure OutputStreams that we open via FileSystem.OutputStream(path) are closed. Eagerly closing OutputStreams avoids hanging on to file handles until the garbage collector finalizes the OutputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See #5512 RELNOTES: none PiperOrigin-RevId: 203342889
bazel-io
pushed a commit
that referenced
this issue
Jul 5, 2018
Use the "with" statement to open files in various Python scripts used by Bazel, to ensure these files are closed eagerly. See #5512 RELNOTES: none PiperOrigin-RevId: 203346678
bazel-io
pushed a commit
that referenced
this issue
Jul 9, 2018
Follow-up to commit 59f17d6. Use try-with-resources to ensure Reader objects are closed eagerly. Eagerly closing Readers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See #5512 RELNOTES: none PiperOrigin-RevId: 203771262
bazel-io
pushed a commit
that referenced
this issue
Jul 10, 2018
Follow-up to commit 09d2031. Use try-with-resources to ensure Writer objects are closed eagerly. Eagerly closing Writers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See #5512 RELNOTES: none PiperOrigin-RevId: 203934471
I think this is all fixed now. |
werkt
pushed a commit
to werkt/bazel
that referenced
this issue
Aug 2, 2018
Use try-with-resources to ensure InputStreams that we open via FileSystem.InputStream(path) are closed. Eagerly closing InputStreams avoids hanging on to file handles until the garbage collector finalizes the InputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild#5512 RELNOTES: none PiperOrigin-RevId: 203338148
werkt
pushed a commit
to werkt/bazel
that referenced
this issue
Aug 2, 2018
Use try-with-resources to ensure OutputStreams that we open via FileSystem.OutputStream(path) are closed. Eagerly closing OutputStreams avoids hanging on to file handles until the garbage collector finalizes the OutputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild#5512 RELNOTES: none PiperOrigin-RevId: 203342889
werkt
pushed a commit
to werkt/bazel
that referenced
this issue
Aug 2, 2018
Use the "with" statement to open files in various Python scripts used by Bazel, to ensure these files are closed eagerly. See bazelbuild#5512 RELNOTES: none PiperOrigin-RevId: 203346678
werkt
pushed a commit
to werkt/bazel
that referenced
this issue
Aug 2, 2018
Follow-up to commit 59f17d6. Use try-with-resources to ensure Reader objects are closed eagerly. Eagerly closing Readers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild#5512 RELNOTES: none PiperOrigin-RevId: 203771262
werkt
pushed a commit
to werkt/bazel
that referenced
this issue
Aug 2, 2018
Follow-up to commit 09d2031. Use try-with-resources to ensure Writer objects are closed eagerly. Eagerly closing Writers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild#5512 RELNOTES: none PiperOrigin-RevId: 203934471
luca-digrazia
pushed a commit
to luca-digrazia/DatasetCommitsDiffSearch
that referenced
this issue
Sep 4, 2022
Follow-up to commit 09d20311d982606093ed881d779bb05a5ee70ed3. Use try-with-resources to ensure Writer objects are closed eagerly. Eagerly closing Writers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild/bazel#5512 RELNOTES: none PiperOrigin-RevId: 203934471
luca-digrazia
pushed a commit
to luca-digrazia/DatasetCommitsDiffSearch
that referenced
this issue
Sep 4, 2022
Follow-up to commit 59f17d6e0550bf63a0b6ef182e2d63474e058ede. Use try-with-resources to ensure Reader objects are closed eagerly. Eagerly closing Readers avoids hanging on to file handles until the garbage collector finalizes the object, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild/bazel#5512 RELNOTES: none PiperOrigin-RevId: 203771262
luca-digrazia
pushed a commit
to luca-digrazia/DatasetCommitsDiffSearch
that referenced
this issue
Sep 4, 2022
Use try-with-resources to ensure OutputStreams that we open via FileSystem.OutputStream(path) are closed. Eagerly closing OutputStreams avoids hanging on to file handles until the garbage collector finalizes the OutputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild/bazel#5512 RELNOTES: none PiperOrigin-RevId: 203342889
luca-digrazia
pushed a commit
to luca-digrazia/DatasetCommitsDiffSearch
that referenced
this issue
Sep 4, 2022
Use try-with-resources to ensure InputStreams that we open via FileSystem.InputStream(path) are closed. Eagerly closing InputStreams avoids hanging on to file handles until the garbage collector finalizes the InputStream, meaning Bazel on Windows (and other processes) can delete or mutate these files. Hopefully this avoids intermittent file deletion errors that sometimes occur on Windows. See bazelbuild/bazel#5512 RELNOTES: none PiperOrigin-RevId: 203338148
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Description of the problem / feature request:
The Bazel server (the Java code) sometimes opens streams without closing them, relying on the garbage collector to finalize the InputStream and close the file. This leads to Bazel holding on to files and (on Windows) being unable to delete them later.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Examples:
bazel/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
Lines 270 to 276 in 52035c1
bazel/src/main/java/com/google/devtools/build/lib/analysis/actions/LauncherFileWriteAction.java
Line 78 in 52035c1
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
Line 314 in 52035c1
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/android/SdkMavenRepository.java
Line 203 in 52035c1
Correct usage would be try-with-resources:
bazel/src/main/java/com/google/devtools/build/lib/exec/BinTools.java
Line 242 in 52035c1
What's the output of
bazel info release
?release 0.15.0
The text was updated successfully, but these errors were encountered: