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

Malformed bazel query command crashes with "Illegal char <*> at index" on Windows #15962

Open
Marcono1234 opened this issue Jul 24, 2022 · 2 comments
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@Marcono1234
Copy link

Marcono1234 commented Jul 24, 2022

Description of the bug:

It looks like using a malformed (?) bazel query command can crash Bazel on Windows:

Loading: 0 packages loaded
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'FILE_STATE:[#redacted#/gson]/[*]' (requested by nodes 'FILE:[#redacted#/gson]/[*]')
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:674)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
        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.nio.file.InvalidPathException: Illegal char <*> at index 42: #redacted#\gson\*
        at java.base/sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
        at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at java.base/sun.nio.fs.WindowsPath.parse(Unknown Source)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
        at java.base/java.io.File.toPath(Unknown Source)
        at com.google.devtools.build.lib.windows.WindowsFileSystem.getAttribs(WindowsFileSystem.java:251)
        at com.google.devtools.build.lib.windows.WindowsFileSystem.stat(WindowsFileSystem.java:153)
        at com.google.devtools.build.lib.vfs.JavaIoFileSystem.statIfFound(JavaIoFileSystem.java:493)
        at com.google.devtools.build.lib.vfs.Path.statIfFound(Path.java:339)
        at com.google.devtools.build.lib.skyframe.PerBuildSyscallCache.statImpl(PerBuildSyscallCache.java:235)
        at com.google.devtools.build.lib.skyframe.PerBuildSyscallCache.access$400(PerBuildSyscallCache.java:34)
        at com.google.devtools.build.lib.skyframe.PerBuildSyscallCache$Builder.lambda$build$0(PerBuildSyscallCache.java:95)
        at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$2(LocalLoadingCache.java:141)
        at com.github.benmanes.caffeine.cache.UnboundedLocalCache.lambda$computeIfAbsent$2(UnboundedLocalCache.java:239)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
        at com.github.benmanes.caffeine.cache.UnboundedLocalCache.computeIfAbsent(UnboundedLocalCache.java:235)
        at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108)
        at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:54)
        at com.google.devtools.build.lib.skyframe.PerBuildSyscallCache.statIfFound(PerBuildSyscallCache.java:114)
        at com.google.devtools.build.lib.skyframe.PerBuildSyscallCache.getType(PerBuildSyscallCache.java:181)
        at com.google.devtools.build.lib.actions.FileStateValue.create(FileStateValue.java:83)
        at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:63)
        at com.google.devtools.build.lib.skyframe.FileStateFunction.compute(FileStateFunction.java:33)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:590)
        ... 7 more

Even if the command is invalid, it should probably not crash Bazel.

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

  1. Download Bazel; I used https://github.com/bazelbuild/bazel/releases/download/5.2.0/bazel-5.2.0-windows-x86_64.exe
  2. Clone https://github.com/bazelbuild/examples at commit bazelbuild/examples@12e1ab6
  3. Run:
    cd examples/java-tutorial
    
    bazel-5.2.0-windows-x86_64.exe query "//*"
    
    ❌ It crashes

Which operating system are you running Bazel on?

Windows 10

What is the output of bazel info release?

release 5.2.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?

There are mutliple other "Illegal char <...> at index" issues at this GitHub repository here, though all are closed (not sure if all are really fixed however).

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

No response

@sgowroji
Copy link
Member

Hello @Marcono1234, Could you please provide complete steps to reproduce the above issue. Am not able to reproduce the above at my end and below are the logs.

ERROR: no such package '*': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.

  • /Users/sgowroji/bazelworkspace/gson/*

@Marcono1234
Copy link
Author

I have updated the reproduction steps now to use the example project from https://github.com/bazelbuild/examples and included how I obtained the Bazel binary. Do you need any additional information?

@sgowroji sgowroji added type: bug team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged and removed more data needed labels Jul 25, 2022
@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) area-Windows Windows-specific issues and feature requests and removed untriaged labels Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests 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

3 participants