Skip to content

Illegal reflective access by com.google.protobuf.UnsafeUtil when running Bazel 0.17.1 #6151

Closed

Description

@xingao267

Description of the problem / feature request:

I install Bazel 0.17.1 in a fresh ubuntu:xenial container using the installer.sh, and when I run bazel version it gives the following warnings:

bazel version
Extracting Bazel installation...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/root/.cache/bazel/_bazel_root/install/28c1d2ace0add449e21862ae9f2d2289/_embedded_binaries/A-server.jar) to field java.lang.String.value
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
Build label: 0.17.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Sep 14 10:39:25 2018 (1536921565)
Build timestamp: 1536921565
Build timestamp as int: 1536921565

Feature requests: what underlying problem are you trying to solve with this feature?

I'm just not sure if that's expected with the new version.

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

docker run -it ubuntu:xenial bash
apt-get update && apt-get install -y wget unzip
wget https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-installer-linux-x86_64.sh
chmod +x bazel-0.17.1-installer-linux-x86_64.sh
./chmod +x bazel-0.17.1-installer-linux-x86_64.sh
bazel version

What operating system are you running Bazel on?

ubuntu xenial docker container

What's the output of bazel info release?

bazel info release
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/root/.cache/bazel/_bazel_root/install/28c1d2ace0add449e21862ae9f2d2289/_embedded_binaries/A-server.jar) to field java.lang.String.value
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
ERROR: The 'info' command is only supported from within a workspace.
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".

Have you found anything relevant by searching the web?

#5599

Activity

  1. changed the title [-]Illegal reflective access by com.google.protobuf.UnsafeUtil[/-] [+]Illegal reflective access by com.google.protobuf.UnsafeUtil when running Bazel 0.17.1[/+] on Sep 14, 2018
  2. cushon commented on Sep 14, 2018

    @cushon
    Contributor

    I'm just not sure if that's expected with the new version.

    We should suppress those warnings, but it's harmless to ignore them for now.

    And you should only see these on startup, i.e. subsequent runs of bazel version shouldn't print warnings.

  3. jgavris commented on Sep 14, 2018

    @jgavris
    Contributor

    I see them during every build, not just on startup.

    INFO: From Checking the completeness of the deps for external/androidx_vectordrawable_vectordrawable_1_0_0_beta01/_aar/androidx_vectordrawable_vectordrawable_1_0_0_beta01/classes_and_libs_merged.jar:
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/private/var/tmp/_bazel_jgavris/install/5d78d317e261432eb3abd12e67760ca9/_embedded_binaries/embedded_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ImportDepsChecker_deploy.jar) to field java.nio.Buffer.address
    WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
  4. cushon commented on Sep 14, 2018

    @cushon
    Contributor

    That's a different instance of the same problem, the same suppression flags are needed here too:

    main_class = "com.google.devtools.build.importdeps.Main",

  5. steeve commented on Sep 15, 2018

    @steeve
    Contributor

    When buliding an android app it does spit out a lot of them building the build, it seems everytime a java process it started.

  6. iirina commented on Sep 25, 2018

    @iirina
    Contributor

    Was this fixed?

  7. added
    team-Rules-Java
    on Sep 25, 2018
  8. xingao267 commented on Sep 25, 2018

    @xingao267
    ContributorAuthor

    efdb3f6 seems not cherry-picked in 0.17.2. Will it be included in 0.18 @aehlig?

  9. bczwartk commented on Oct 18, 2018

    @bczwartk

    efdb3f6 seems not cherry-picked in 0.17.2. Will it be included in 0.18 @aehlig?

    AFAICT, the problem still exists in 0.18.0. ANd the warnings are printed sometimes when I run bazel command. E.g. it happend for 'bazel version' and 'bazel shutdown', or help
    Running on Ubuntu 16.04.5 LTS

  10. alexeagle commented on Oct 23, 2018

    @alexeagle
    Contributor

    Several of us on Angular team observed this after update to 0.18

  11. philwo commented on Oct 24, 2018

    @philwo
    Member

    Building Bazel HEAD using Bazel 0.18.0 in IntelliJ on my Arch Linux box (no matter if system JDK is 8 or 10) spams the build log with ~100 of these annoying messages.

  12. cushon commented on Oct 24, 2018

    @cushon
    Contributor

    @alexeagle @philwo this affects every Java binary that transitively depends on protos: protocolbuffers/protobuf#3781

    Which specific tools are you seeing generate warnings? The fix is to add the following JVM flags:

        jvm_flags = [
            # quiet warnings from com.google.protobuf.UnsafeUtil,
            # see: https://github.com/google/protobuf/issues/3781
            "-XX:+IgnoreUnrecognizedVMOptions",
            "--add-opens=java.base/java.nio=ALL-UNNAMED",
            "--add-opens=java.base/java.lang=ALL-UNNAMED",
        ],
    
  13. philwo commented on Nov 2, 2018

    @philwo
    Member

    @cushon This is what I'm seeing:

    INFO: From Parsing java package strings for //src/main/java/com/google/devtools/build/lib/windows/jni:processes:
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.google.protobuf.repackaged.UnsafeUtil (file:/home/philwo/.IntelliJIdea2018.2/config/plugins/ijwb/aspect/tools/PackageParser_deploy.jar) to field java.nio.Buffer.address
    WARNING: Please consider reporting this to the maintainers of com.google.protobuf.repackaged.UnsafeUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    

    I guess it comes from our IntelliJ plugin?

  14. cgruber commented on Nov 8, 2018

    @cgruber
    Contributor

    I'm getting it, and I quote: "From parsing Android resources for //path/to/package".

    Then I get the full set of warnings. It'd be superlatively nice to shut them up, especially since literally every android_library seems to be triggering it. I really don't want to add it to every library target.

  15. added
    untriaged
    on Jan 14, 2019
  16. davispuh commented on Jan 25, 2019

    @davispuh

    Still happens with 0.21.0

    $ bazel version
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/tmp/Viesis/.cache/bazel/_bazel_Viesis/install/90846db665bd444d85cd9a305cffe931/_embedded_binaries/A-server.jar) to field java.nio.Buffer.address
    WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
    INFO: Invocation ID: c58d4149-cb9e-4139-aabc-60b7e0b2921e
    Build label: 0.21.0- (@non-git)
    Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
    Build time: Thu Dec 20 19:15:52 2018 (1545333352)
    Build timestamp: 1545333352
    Build timestamp as int: 1545333352
    
  17. added
    team-Core
    and removed
    team-Rules-Java
    on Mar 14, 2019
  18. ericfelly commented on Aug 13, 2019

    @ericfelly
    Contributor

    Dupe of #5439?

  19. removed
    untriaged
    on Aug 13, 2019
  20. removed their assignment
    on Jan 9, 2020
  21. meisterT commented on May 16, 2020

    @meisterT
    Member

    This is fixed as of Bazel from today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    team-Core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions