Skip to content

bazel_command_log_test fails with JDK9 #5314

Closed

Description

@buchgr

#5312

https://source.cloud.google.com/results/invocations/770bf9b2-9fa7-4557-9713-10add653bc5f/targets/%2F%2Fsrc%2Ftest%2Fshell%2Fintegration:bazel_command_log_test/tests

< WARNING: An illegal reflective access operation has occurred
< WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ab11d4d7718c577e34d29e80c1ea7a24/sandbox/4792110657591662707/execroot/io_bazel/_tmp/bf89598a54a896b6604732eca0b954fe/root/install/e2abbe56c2f5d3ad340474a4994591d4/_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

I assume we can resolve this by updating protobuf to the latest version, which should support JDK9. Maybe @cushon knows?

Activity

  1. self-assigned this
    on Jun 1, 2018
  2. cushon commented on Jun 1, 2018

    @cushon
    Contributor

    This is protocolbuffers/protobuf#3781.

    Passing --add-opens=java.base/java.nio=ALL-UNNAMED suppresses the warning. That flag isn't backwards-compatible with JDK 8. The other option is to ignore the warning in the test :/

  3. cushon commented on Jun 1, 2018

    @cushon
    Contributor

    Here's a fix:

    diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
    index 655406ae94..835ceaf9a9 100644
    --- a/src/main/cpp/blaze.cc
    +++ b/src/main/cpp/blaze.cc
    @@ -414,6 +414,10 @@ static vector<string> GetArgumentArray(
       string heap_crash_path = globals->options->output_base;
       result.push_back("-XX:HeapDumpPath=" + blaze::PathAsJvmFlag(heap_crash_path));
     
    +  // quiet warnings from com.google.protobuf.UnsafeUtil,
    +  // see: https://github.com/google/protobuf/issues/3781
    +  result.push_back("--add-opens=java.base/java.nio=ALL-UNNAMED");
    +
       result.push_back("-Xverify:none");
     
       vector<string> user_options;
    

    (That will need to happen in the same change as #5312, since the JVM flag isn't backwards compatible with JDK 8.)

  4. buchgr commented on Jun 2, 2018

    @buchgr
    ContributorAuthor

    @cushon awesome! I have updated #5312

  5. cushon commented on Jun 6, 2018

    @cushon
    Contributor

    @buchgr the fix I suggested regresses //src/test/shell/bazel:bazel_bootstrap_distfile_test. The bootstrap bazel doesn't use the embedded JDK so it defaults to using the local JDK 8, and --add-opens isn't compatible with JDK 8.

    e.g. https://buildkite.com/bazel/bazel-bazel/builds/2579#2dfdde87-9ec0-4218-be2d-8b664d633708

    One option is to make the bootstrap build use JDK 9 as the --host_javabase, either by making the bootstrap build embedded a JDK, or separately installing a JDK 9 and setting --host_javabase in the bootstrap script. Is that something you could help with?

    Another option is to just ignore the warnings during the test, but users running bazel info will see the same warning spam, which we should avoid. And ultimately we don't intend to support JDK 8 as a --host_javabase for much longer, so we'll need to deal with bootstrapping either way.

  6. added a commit that references this issue on Jun 11, 2018
  7. added a commit that references this issue on Aug 2, 2018
  8. buchgr commented on Aug 6, 2018

    @buchgr
    ContributorAuthor

    this has been fixed

  9. added a commit that references this issue on Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions