Skip to content
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 builds fail with "Error in download_and_extract: java.io.IOException: Couldn't delete temporary directory" #20013

Open
ryanmacdonald opened this issue Oct 31, 2023 · 8 comments
Assignees
Labels
awaiting-user-response Awaiting a response from the author P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@ryanmacdonald
Copy link

Description of the bug:

Our team recently migrated our build to use Bazel v6.3.0, and we're seeing this error sometimes when we run a fresh build:

Analyzing: target <target I'm building>
INFO: Repository remote_java_tools_linux instantiated at: 
  /DEFAULT.WORKSPACE.SUFFIX:374:6: in <toplevel>
  <project_root_dir>/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule http_archive defined at: 
  <project_root_dir>/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
ERROR: An error occurred during the fetch of repository 'remote_java_tools_linux':
   Traceback (most recent call last):
  File "<project_root_dir>/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
    download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Couldn't delete temporary directory (<project_root_dir>/remote_java_tools_linux/temp6718266017446538312)

As far as I understand, @remote_java_tools_linux is a dependency that Bazel pulls in as part of supporting native build macros that compile Java code, so I'm not sure why a user would be seeing permissions issues. Thoughts on what might be going wrong or how to proceed with debug?

Which category does this issue belong to?

External Dependency

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?

Red Hat Enterprise Linux Server v7.9

What is the output of bazel info release?

release 6.3.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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No, but solicited help for this error on Stackoverflow, and the Bazel community slack without any engagement

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

No response

@iancha1992
Copy link
Member

@ryanmacdonald Could you please provide sample code (repo) to reproduce this issue?

@ryanmacdonald
Copy link
Author

@iancha1992 it will be difficult for me to do that, since the repo is closed source and the error occurs seemingly randomly from a fresh clone. Do you have any pointers on why this would occur or how I could proceed debugging it myself?

@iancha1992 iancha1992 added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged and removed more data needed labels Nov 2, 2023
@meteorcloudy
Copy link
Member

meteorcloudy commented Nov 7, 2023

https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java;l=728-732

We should probably propagate the actual error message here to get more clue about why the deletion is failing.

@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Nov 7, 2023
@meteorcloudy meteorcloudy self-assigned this Nov 7, 2023
@meteorcloudy
Copy link
Member

meteorcloudy commented Nov 24, 2023

@ryanmacdonald I created a custom binary based on 6.4.0 release with the actual error message propagated: https://github.com/bazelbuild/bazel/commits/release-6.4.0-gh-20013.

Can you please use Bazelisk with USE_BAZEL_VERSION=d015070467764158c34e60262c96dc62177964ad to rerun the build? Hopefully, we'll get more useful information for debugging.

copybara-service bot pushed a commit that referenced this issue Nov 24, 2023
…ng temporary directory failed

Related: #20013
PiperOrigin-RevId: 585046630
Change-Id: Ifdf098e7d54c1d5dca85a39afd7694dc828331a4
@ryanmacdonald
Copy link
Author

Hi @meteorcloudy, is it possible you could create a custom binary based on the 6.3.0 release for this, or give me guidance on how to do that myself? On a recent bazelisk auto-bump to 6.4.0 our builds started failing because of a C++ dependency error, so we're on 6.3.0 for now

@meteorcloudy
Copy link
Member

meteorcloudy commented Nov 28, 2023

@ryanmacdonald I pushed https://github.com/bazelbuild/bazel/commits/release-6.3.0-gh-20013, please wait about half an hour until our CI publishes binaries for 37c5c4c

@Wyverald Wyverald added the awaiting-user-response Awaiting a response from the author label Feb 20, 2024
@jscheid-ventana
Copy link

jscheid-ventana commented Mar 4, 2024

We see this, as rarely as every six months, for at least 2.25 years. First on 4.2.1, now on 6.5.0. We do not know how to reproduce. Likely to do with new output bases, possibly with multiple client processes vying for a server lock.

It'd be nice to get the error message to be more specific. Also we observe it to exit with code 1, but perhaps a different code would help, especially if this ends up being an intermittent issue that could be retried successfully.

bazel-io pushed a commit to bazel-io/bazel that referenced this issue Mar 4, 2024
…ng temporary directory failed

Related: bazelbuild#20013
PiperOrigin-RevId: 585046630
Change-Id: Ifdf098e7d54c1d5dca85a39afd7694dc828331a4
github-merge-queue bot pushed a commit that referenced this issue Mar 4, 2024
…n deleting temporary directory failed (#21555)

Related: #20013
Commit
5b4ba3e

PiperOrigin-RevId: 585046630
Change-Id: Ifdf098e7d54c1d5dca85a39afd7694dc828331a4

Co-authored-by: Googler <[email protected]>
@sthornington
Copy link
Contributor

ERROR: no such package '@@crate_index__adler2-2.0.0//': java.io.IOException: Couldn't delete temporary directory (/[...]/bazel_base/30530ab654f51d2e19c2cea9f38f4878/external/crate_index__adler2-2.0.0/temp13769777110914705970): /[...]/bazel_base/30530ab654f51d2e19c2cea9f38f4878/external/crate_index__adler2-2.0.0/temp13769777110914705970 (Directory not empty)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-user-response Awaiting a response from the author P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

No branches or pull requests

8 participants