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

crash on invalid repository name in bazel 8.0.0 #24621

Closed
martingms opened this issue Dec 10, 2024 · 3 comments
Closed

crash on invalid repository name in bazel 8.0.0 #24621

martingms opened this issue Dec 10, 2024 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@martingms
Copy link

Description of the bug:

I'm trying to upgrade to 8.0.0 but bazel crashes with invalid repository name no matter what target I'm trying to build.
I've both rm'd MODULE.bazel.lock and ran bazel clean --expunge.

@fmeum suggested on slack that this is likely a rules_python bug, but that bazel probably shouldn't crash on this anyway.

Which category does this issue belong to?

Core

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?

Linux 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux

What is the output of bazel info release?

release 8.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 HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

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

The crash with stacktrace:

java.lang.RuntimeException: Unrecoverable error while evaluating node '[/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5]/[external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu]' (requested by nodes 'FILE:[/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5]/[external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu]')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:547)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:435)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.util.concurrent.CompletionException: com.google.devtools.build.lib.cmdline.LabelSyntaxException: invalid repository name 'rules_python~~python~python_3_11_x86_64-unknown-linux-gnu': repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'
	at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$3(LocalLoadingCache.java:204)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$13(BoundedLocalCache.java:2451)
	at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2449)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2432)
	at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:107)
	at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:57)
	at com.google.devtools.build.lib.cmdline.RepositoryName.createUnvalidated(RepositoryName.java:107)
	at com.google.devtools.build.lib.rules.repository.RepositoryFunction.addExternalFilesDependencies(RepositoryFunction.java:408)
	at com.google.devtools.build.lib.skyframe.ExternalFilesHelper.maybeHandleExternalFile(ExternalFilesHelper.java:287)
	at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:61)
	at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:35)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
	... 7 more
Caused by: com.google.devtools.build.lib.cmdline.LabelSyntaxException: invalid repository name 'rules_python~~python~python_3_11_x86_64-unknown-linux-gnu': repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'
	at com.google.devtools.build.lib.cmdline.LabelParser.syntaxErrorf(LabelParser.java:208)
	at com.google.devtools.build.lib.cmdline.RepositoryName.validate(RepositoryName.java:191)
	at com.google.devtools.build.lib.cmdline.RepositoryName.lambda$static$0(RepositoryName.java:71)
	at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$3(LocalLoadingCache.java:197)
@martingms
Copy link
Author

martingms commented Dec 11, 2024

Some more digging (with a grep -r "rules_python~~python~python_3_11_x86_64-unknown-linux-gnu" /), and I found a single reference (apart from some bazel log files about the crashes):
~/<redacted>/.venv/pyvenv.cfg:home = /home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu/bin
which is a venv created by rules_py's py_venv... Nuking that fixed it.

I don't know whether you consider crashing on this a bug or not, so feel free to close the issue if not 👍

@meteorcloudy
Copy link
Member

Yeah, ideally Bazel should fail more gracefully, but at least this time it crashed with some useful information.

@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. and removed team-Core Skyframe, bazel query, BEP, options parsing, bazelrc untriaged labels Dec 11, 2024
@fmeum fmeum self-assigned this Dec 12, 2024
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Dec 19, 2024
Fixes bazelbuild#24621

Closes bazelbuild#24666.

PiperOrigin-RevId: 708009380
Change-Id: I8706f1fdfba2282a27e84dff610e6511c1060e23
github-merge-queue bot pushed a commit that referenced this issue Dec 26, 2024
…24771)

Fixes #24621

Closes #24666.

PiperOrigin-RevId: 708009380
Change-Id: I8706f1fdfba2282a27e84dff610e6511c1060e23

Commit
7e7ae8c

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 8.0.1 RC1. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=8.0.1rc1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

6 participants