-
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 clean --expunge
often fails on Windows
#1586
Comments
The |
I did some debugging. On Linux we can delete the |
I get a similar issue when using new_local_repository, it seems the |
@jakemac53 : Thanks for reporting that. It doesn't sound like the same issue to me. Is it reproducible? If so, could you please report a separate issue for it? As for this bug I made sure the |
Open files cannot be deleted on Windows, thus `bazel clean --expunge` fails when it attemps to delete the `command.log` that stdout/stderr is tee'd into, and so does BlazeCommandDispatcher when it attemps to delete the `command.log` just before dispatching to the command implementation (not just `clean` but any command). This change: - closes `command.log` before we attempt to delete it - marks CleanCommand (through the Command annotation) as one that should not write to the command.log, thus we don't create a new instance of the file This change allows `bazel clean --expunge` to delete everything in the output base, with the exception of `jvm.log`. Unfortunately that file is opened by the C++ bazel client process, so we have to close it there prior to sending the clean to the bazel server. See #1586 -- MOS_MIGRATED_REVID=137278553
Is 7f3ffbc in 0.4.0-rc3?
|
The release candidate was cut prior to this commit. :( |
+Kristina Chodorow kchodorow@google.com is the 0.4 release manager. I On Mon, Oct 31, 2016 at 4:57 PM László Csomor notifications@github.com
|
It's a P1, so important. When's the next release expected, if this doesn't make into 0.4? |
Every month so somewhere in November. On Mon, Oct 31, 2016 at 5:24 PM László Csomor notifications@github.com
|
It's certainly in 0.4.2 now. |
We still see "bazel clean" failures sometimes, and it may be due to the persistent java workers holding on to open files, which is also the suspected culprit of #2538. |
@laszlocsomor @philwo what's the right target milestone? Is it still a P1? |
(Sorry, wrong bug. Moving my comment to the correct one.) |
Sorry, dcaee09 is an irrelevant commit. |
Steren probably have the wrong bug number in he change |
This is still an issue. |
I ran into this just now:
@laszlocsomor explained that it happens because the Java server tries to delete its log file, which it holds an open handle to (because its stdout is redirected to that file) and thus fails to delete it. We could create the file with delete sharing permissions, which would allow the server to delete it despite the open handle, but then writes to the deleted file will be lost. @philwo pointed out that we only try to delete the log file with clean --expunge, but when doing so, we also exit the server process after the clean command finished - so the situation where we try to write to the deleted log file should actually never happen (and even if it happens, it's probably rather irrelevant). |
I realized this is wrong. The file in question is "java.log", which is created and held open by the java process, see startup_options.cc:416. The file I talked about earlier was "jvm.log", which is indeed created in blaze::CreateJvmOutputFile so we could open that with deletion sharing. |
Open files cannot be deleted on Windows, thus `bazel clean --expunge` fails when it attemps to delete the `command.log` that stdout/stderr is tee'd into, and so does BlazeCommandDispatcher when it attemps to delete the `command.log` just before dispatching to the command implementation (not just `clean` but any command). This change: - closes `command.log` before we attempt to delete it - marks CleanCommand (through the Command annotation) as one that should not write to the command.log, thus we don't create a new instance of the file This change allows `bazel clean --expunge` to delete everything in the output base, with the exception of `jvm.log`. Unfortunately that file is opened by the C++ bazel client process, so we have to close it there prior to sending the clean to the bazel server. See bazelbuild/bazel#1586 -- MOS_MIGRATED_REVID=137278553
command.log
contains no information about thebazel clean --expunge
failure, only output of the previous build commands.The text was updated successfully, but these errors were encountered: