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 due to IGNORED_SUBDIRECTORIES introduced in PR #23999 #24611

Closed
jpsim opened this issue Dec 9, 2024 · 8 comments
Closed

Crash due to IGNORED_SUBDIRECTORIES introduced in PR #23999 #24611

jpsim opened this issue Dec 9, 2024 · 8 comments
Assignees
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob type: bug untriaged

Comments

@jpsim
Copy link

jpsim commented Dec 9, 2024

Description of the bug:

I'm experiencing a new crash in 8.0.0rc8 that doesn't occur in 7.4.1 or 8.0.0rc1, seemingly introduced in #23999.

Here's what the crash stack trace looks like:

$ USE_BAZEL_VERSION=8.0.0rc8 bazel run cli
Starting local Bazel server and connecting to it...
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols.
Analyzing: target //:cli (72 packages loaded, 1277 targets configured)
    Fetching repository @@apple_support++apple_cc_configure_extension+local_config_apple_cc; starting
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'IGNORED_SUBDIRECTORIES:@@rules_swift_package_manager++swift_deps+swiftpkg_asc_swift' (requested by nodes 'PACKAGE_LOOKUP:@@rules_swift_package_manager++swift_deps+swiftpkg_asc_swift//')
	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$RunnableExecuteAction.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.lang.IllegalArgumentException
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:131)
	at com.google.devtools.build.lib.cmdline.IgnoredSubdirectories.of(IgnoredSubdirectories.java:103)
	at com.google.devtools.build.lib.skyframe.IgnoredSubdirectoriesValue.of(IgnoredSubdirectoriesValue.java:45)
	at com.google.devtools.build.lib.skyframe.IgnoredSubdirectoriesFunction.compute(IgnoredSubdirectoriesFunction.java:191)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
	... 7 more

Initially reported here: cgrindel/rules_swift_package_manager#1394

Which category does this issue belong to?

Core, Loading API

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

To reproduce (assuming bazelisk & Xcode are installed):

MODULE.bazel

bazel_dep(name = "apple_support", version = "1.17.1")
bazel_dep(name = "rules_swift", version = "2.2.4")
bazel_dep(name = "rules_swift_package_manager", version = "0.42.0")

swift_deps = use_extension(
    "@rules_swift_package_manager//:extensions.bzl",
    "swift_deps",
)
swift_deps.from_package(
    resolved = "//:Package.resolved",
    swift = "//:Package.swift",
)
use_repo(
    swift_deps,
    "swift_package",
    "swiftpkg_asc_swift",
)

Package.swift

// swift-tools-version: 5.10

import PackageDescription

let package = Package(
    name: "basic_bazel_swift_cli",
    dependencies: [
        .package(url: "https://github.com/aaronsky/asc-swift", from: "1.2.0"),
    ]
)

main.swift

import AppStoreConnect

print("Hello world")

BUILD

load("@rules_swift//swift:swift_binary.bzl", "swift_binary")

swift_binary(
    name = "cli",
    srcs = ["main.swift"],
    deps = [
        "@swiftpkg_asc_swift//:AppStoreConnect",
    ],
)

Run the following:

$ swift package resolve
$ USE_BAZEL_VERSION=7.4.1 bazel run cli
INFO: Analyzed target //:cli (112 packages loaded, 4071 targets configured).
INFO: Found 1 target...
Target //:cli up-to-date:
  bazel-bin/cli
INFO: Elapsed time: 195.762s, Critical Path: 189.37s
INFO: 55 processes: 27 internal, 23 darwin-sandbox, 5 worker.
INFO: Build completed successfully, 55 total actions
INFO: Running command line: bazel-bin/cli
Hello world
$ USE_BAZEL_VERSION=8.0.0rc8 bazel run cli
Starting local Bazel server and connecting to it...
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols.
Analyzing: target //:cli (72 packages loaded, 1277 targets configured)
    Fetching repository @@apple_support++apple_cc_configure_extension+local_config_apple_cc; starting
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'IGNORED_SUBDIRECTORIES:@@rules_swift_package_manager++swift_deps+swiftpkg_asc_swift' (requested by nodes 'PACKAGE_LOOKUP:@@rules_swift_package_manager++swift_deps+swiftpkg_asc_swift//')
	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$RunnableExecuteAction.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.lang.IllegalArgumentException
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:131)
	at com.google.devtools.build.lib.cmdline.IgnoredSubdirectories.of(IgnoredSubdirectories.java:103)
	at com.google.devtools.build.lib.skyframe.IgnoredSubdirectoriesValue.of(IgnoredSubdirectoriesValue.java:45)
	at com.google.devtools.build.lib.skyframe.IgnoredSubdirectoriesFunction.compute(IgnoredSubdirectoriesFunction.java:191)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
	... 7 more

Which operating system are you running Bazel on?

macOS 15.1.1 (24B91)

What is the output of bazel info release?

release 8.0.0rc8

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.

8bfb921

Have you found anything relevant by searching the web?

No response

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

Initially reported here: cgrindel/rules_swift_package_manager#1394

@github-actions github-actions bot added team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob labels Dec 9, 2024
@brentleyjones
Copy link
Contributor

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Dec 9, 2024
@meteorcloudy
Copy link
Member

@meteorcloudy
Copy link
Member

We are going to release Bazel 8, this will be fixed in a patch release coming shortly

@meteorcloudy
Copy link
Member

/cc @lberki

@lberki
Copy link
Contributor

lberki commented Dec 9, 2024

I don't have access to a Mac to reproduce with (hence, no Xcode) and the above reproduction does seem to need it. Is this reproducible somehow without Xcode?

I'm fairly certain @meteorcloudy is right on the money but I only have very limited time this evening and the trivial attempt of using that .bazelignore file, putting a glob in a BUILD file then running bazel query doesn't seem to tickle it with either 8.0.0rc8 or HEAD.

@lberki
Copy link
Contributor

lberki commented Dec 10, 2024

I got a reproduction, I simply made a mistake when trying to reproduce yesterday. It goes like this:

touch MODULE.bazel
echo 'filegroup(name="fg", srcs=glob(["**/*.txt"]))' > BUILD.bazel
echo '/foo' > .bazelignore

bazel query --output=build :fg

The fix is trivial. I could imagine treating /foo as foo in .bazelignore, but given that AFAICT the entries starting with slashes are just ignored, I'll just make it an error (but not a crash).

The workaround is to remove the entries starting with a slash in .bazelignore, since both according to my reading of the code and my experiments, they are ignored anyways.

@lberki lberki self-assigned this Dec 10, 2024
@jpsim
Copy link
Author

jpsim commented Dec 10, 2024

Thank you very much for the quick fix and workaround!

@iancha1992
Copy link
Member

@bazel-io fork 8.1.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob type: bug untriaged
Projects
None yet
Development

No branches or pull requests

8 participants