Skip to content

Output directories are sometimes out of order when using remote execution #5109

Closed

Description

@jjudd

Description of the problem:

When using remote execution (buildfarm) output directories are sometimes out of order. The spec requires them to be lexicographically sorted.

I have a PR that fixes this issue and will link it after creating this issue.

When using remote executing, a parent node is built from action inputs in TreeNodeRepository. The files are sorted by path in RemoteSpawnRunner. These paths are then broken down into segments and a tree structure is created from the segments.

Problem is, the segments at each level of the tree structure are not sorted before they are added to the parent node. This can result in an unordered directory tree.

For example, the sort order of this list of files

/foo/bar-client/bar-client_ijar.jar
/foo/bar/bar_ijar.jar

is maintained when it becomes a tree structure

foo ->
    bar-client ->
        bar-client_ijar.jar
    bar
        bar_ijar.jar

which is out of order.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Create a Bazel project with two packages

/foo/bar-client
/foo/bar

that produce outputs named in a similar fashion. For example, two Java targets that create:

/foo/bar-client/bar-client_ijar.jar
/foo/bar/bar_ijar.jar

Then build those targets using buildfarm or another remote executor. You will receive an error like the following:

Caused by: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: The files in an input `Directory` are not correctly sorted by `name`.
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:221)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:202)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:131)
	at com.google.devtools.remoteexecution.v1test.ExecutionGrpc$ExecutionBlockingStub.execute(ExecutionGrpc.java:370)
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$0(GrpcRemoteExecutor.java:133)
	at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:220)
	at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:101)
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$2(GrpcRemoteExecutor.java:133)
	at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:220)
	... 21 more

What operating system are you running Bazel on?

Ubuntu 16.04 x86_64

What's the output of bazel info release?

$ bazel info release
.........
release 0.12.0

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

james@james:~/opensource/bazel$ git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
[email protected]:bazelbuild/bazel.git
ca76428fe83f73f2428d4fdc1382884108de4fed
ca76428fe83f73f2428d4fdc1382884108de4fed

Activity

  1. added a commit that references this issue on Apr 27, 2018
    c302bce
  2. jjudd commented on Apr 27, 2018

    @jjudd
    ContributorAuthor

    Here is a PR that fixes this issue: #5110

  3. iirina commented on May 2, 2018

    @iirina
    Contributor

    Thanks for the PR! I assigned you since you sent a fix.

  4. added a commit that references this issue on May 7, 2018
    6f7069d
  5. driveraid commented on May 7, 2018

    @driveraid

    Is this fixed? I still see the issue on Bazel 0.13.0 with bazel buildfarm rev 24a5d7e29.

  6. jjudd commented on May 7, 2018

    @jjudd
    ContributorAuthor

    The fix for this was merged a few hours ago. It hasn't been released as far as I know. If you're running off of HEAD, then it should be fixed.

  7. driveraid commented on May 7, 2018

    @driveraid

    Sorry, I was confused about the reference to the 0.13.0 release above.. :)

  8. added a commit that references this issue on May 9, 2018
    af11ae5
  9. driveraid commented on May 28, 2018

    @driveraid

    Seems released in https://github.com/bazelbuild/bazel/releases/tag/0.13.1 right?

    "Important changes:

    Remote Execution: Fixes a regression that produces directories with unsorted file/directory lists"

  10. buchgr commented on May 28, 2018

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions