Skip to content

[Windows]: build failed with Unexpected IO error #4035

Closed

Description

@snnn

Description of the problem / feature request / question:

Cannot build bazel 0.8 branch with bazel 0.8

If possible, provide a minimal example to reproduce the problem:

bazel --output_base D:\bazel_build build --stamp --action_env=USE_DYNAMIC_CRT=1 --config opt --action_env=NO_MSVC_WRAPPER=1 --color=no --compilation_mode opt --verbose_failures --experimental_ui src:bazel.exe

Do it twice. In the first pass, you will get bazel 0.8.0, then you should invoke this command again with this new built bazel.

Environment info

  • Operating System:
    Windows 10

  • Bazel version (output of bazel info release):
    development version

  • If bazel info release returns "development version" or "(@Non-Git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):
    cff0dc9

Have you found anything relevant by searching the web?

Anything else, information or logs or outputs that would be helpful?

ERROR: D:/os/bazel/third_party/protobuf/3.4.0/BUILD:423:1: C++ compilation of rule '//third_party/protobuf/3.4.0:protoc_lib' failed: Unexpected IO error.: D:/bazel_build/execroot/io_bazel (Not a directory)

Activity

  1. self-assigned this
    on Nov 7, 2017
  2. dslomov commented on Nov 7, 2017

    @dslomov
    Contributor

    Potential release blocker for 0.8: #3772

  3. added
    P1
    on Nov 7, 2017
  4. laszlocsomor commented on Nov 7, 2017

    @laszlocsomor
    Contributor

    Thanks for reporting! However we can't look at this bug this week because we're attending the Bazel conference in Sunnyvale, CA. I'll take a look when we're back in Munich.

  5. laszlocsomor commented on Nov 14, 2017

    @laszlocsomor
    Contributor

    @snnn : Can you reliably repro the failure the way you described? Also, what's in your ".bazelrc" file? (Because --config opt is only effective if you have entries like build:opt in your .bazelrc).

    I failed to repro this issue like so:

    $ cd /c/work/bazel
    $ git checkout origin/release-0.8.0
    
    C:\work\bazel>subst d: c:\d_drive
    
    C:\work\bazel>c:\work\bazel-0.8.0\rc1\bazel.exe --output_base d:\tmp1 build --stamp --action_env=USE_DYNAMIC_CRT=1 --action_env=NO_MSVC_WRAPPER=1 --compilation_mode opt --verbose_failures --experimental_ui src:bazel.exe
    (...)
    
    C:\work\bazel>D:/tmp1/execroot/io_bazel/bazel-out/x64_windows-opt/bin/src/bazel.exe --output_base d:\tmp1 build --stamp --action_env=USE_DYNAMIC_CRT=1 --action_env=NO_MSVC_WRAPPER=1 --compilation_mode opt --verbose_failures --experimental_ui src:bazel.exe
    (...)
    

    For me, both builds succeed.

  6. snnn commented on Nov 15, 2017

    @snnn
    Author

    Hi @laszlocsomor , It's strange. I can 100% re-produce this problem on my local host. I don't have any .bazelrc. How can I provide more information to you?

    Thanks.

  7. snnn commented on Nov 17, 2017

    @snnn
    Author

    Ok... I guess I find the reason.

    In LocalSpawnRunner.java

      private static Path createActionTemp(Path execRoot) throws IOException {
        // Use this executor thread's ID as the directory name's suffix.
        // The ID is safe for the following reasons:
        // - being a thread ID, it's guaranteed to be unique among other action executor threads
        // - this thread will only execute one action at a time, so there's no risk of concurrently
        //   running actions using the same temp directory.
        // The next action that this thread executes can reuse the temp directory name. The only caveat
        // is, if {@link #start} fails to delete directory after the action is done, the next
        // action will see stale files in its temp directory.
        String idStr = Long.toHexString(Thread.currentThread().getId());
        Path result = execRoot.getRelative("tmp" + idStr);
        if (!result.exists() && !result.createDirectory()) {
          throw new IOException(String.format("Could not create temp directory '%s'", result));
        }
        return result;
      }

    You can't do this on Windows. DeleteFile is an async operation. You shouldn't recreate the directory shortly after deleting it.

  8. snnn commented on Nov 17, 2017

    @snnn
    Author

    This bug is introduced in cfccdf1

  9. laszlocsomor commented on Nov 17, 2017

    @laszlocsomor
    Contributor

    Wow, that's an impressive diagnosis! Thank you!
    I still couldn't repro this issue, however your explanation seems plausible.

  10. dslomov commented on Nov 17, 2017

    @dslomov
    Contributor

    This is a release blocker for 0.8.0

  11. laszlocsomor commented on Nov 20, 2017

    @laszlocsomor
    Contributor

    This commit broke some of our internal tests. I'll take a look and fix them soon (this morning or early afternoon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1platform: windowstype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions