bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.21k stars 4.06k forks source link

Builds fail with FileAlreadyExistsException with IDL temp dir in extractIdlClasses #15521

Open nkoroste opened 2 years ago

nkoroste commented 2 years ago

Description of the bug:

ERROR: [0m/private/var/lib/jenkins/workspace/android/components/service-manager/settings/BUILD.bazel:15:16: Building idl jars components/service-manager/settings/libaidl-idl.jar failed: (Exit 1): IdlClass failed: error executing command
(cd /Users/devicelab/Dev/.cache/_bazel_root/1470e837387673c804a096195fba2583/execroot/__main__ && \
exec env - \
bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/idlclass/IdlClass --manifest_proto bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/libaidl.jar_manifest_proto --class_jar bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/libaidl.jar --output_class_jar bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/libaidl-idl.jar --output_source_jar bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/libaidl-idl.srcjar --temp_dir bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/_idl/aidl/libaidl_temp bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/aidl_aidl/components/service-manager/settings/src/main/aidl/com/snap/settings/FooService.java)
# Configuration: bda8eb3b3fc265640cdb4dbb8bc334435d0d2bb57d443a645485b277748e62f5
# Execution platform: @local_config_platform//:host
Exception in thread "main" java.nio.file.FileAlreadyExistsException: bazel-out/darwin_arm64-fastbuild/bin/components/service-manager/settings/_idl/aidl/libaidl_temp/classjar/com/snap/settings/FooService$Default.class
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
at java.base/java.nio.file.Files.newOutputStream(Files.java:220)
at java.base/java.nio.file.Files.copy(Files.java:3067)
at com.google.devtools.build.android.idlclass.IdlClass.extractIdlClasses(IdlClass.java:153)
at com.google.devtools.build.android.idlclass.IdlClass.writeClassJar(IdlClass.java:69)
at com.google.devtools.build.android.idlclass.IdlClass.main(IdlClass.java:61)

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

No response

Which operating system are you running Bazel on?

all

What is the output of bazel info release?

5.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

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

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Fix: https://github.com/bazelbuild/bazel/pull/15362

nkoroste commented 2 years ago

fix https://github.com/bazelbuild/bazel/pull/15362

ahumesky commented 2 years ago

out of curiosity, do you have sandboxing off? seems like this should only happen with sandboxing off