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

Illegal reflective access by com.google.protobuf.UnsafeUtil #5599

Closed
buchgr opened this issue Jul 16, 2018 · 16 comments
Closed

Illegal reflective access by com.google.protobuf.UnsafeUtil #5599

buchgr opened this issue Jul 16, 2018 · 16 comments

Comments

@buchgr
Copy link
Contributor

buchgr commented Jul 16, 2018

After having upgraded Bazel's protobuf to 3.6.0 and Bazel's JDK to 9, we are seeing these warnings wen building protobufs. It's an annoying cosmetic issue.

INFO: From Compiling Java headers src/main/java/com/google/devtools/build/lib/windows/libwindows-hjar.jar (3 files):
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/usr/local/google/home/buchgr/.cache/bazel/_bazel_buchgr/install/e676aae4e6c63bf8d7cfde16175ea874/_embedded_binaries/embedded_tools/tools/jdk/turbine_deploy.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
INFO: From Compiling Java headers src/main/java/com/google/devtools/build/lib/libunix-hjar.jar (10 files) [for host]:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/usr/local/google/home/buchgr/.cache/bazel/_bazel_buchgr/install/e676aae4e6c63bf8d7cfde16175ea874/_embedded_binaries/embedded_tools/tools/jdk/turbine_deploy.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
...

Any thoughts @cushon @rongjiecomputer? Can we possibly prevent them from being printed? The corresponding protobuf issue: protocolbuffers/protobuf#3781

@rongjiecomputer
Copy link
Contributor

My local workaround is adding build --jvmopt=--add-opens=java.base/java.nio=ALL-UNNAMED to .bazelrc.

@cushon
Copy link
Contributor

cushon commented Jul 23, 2018

@buchgr the toolchain includes JVM flags that are supposed to quiet those warnings, but I guess they aren't working:

"--add-opens=java.base/java.nio=ALL-UNNAMED",

@cushon
Copy link
Contributor

cushon commented Jul 23, 2018

Ah, we also want --add-opens=java.base/java.lang=ALL-UNNAMED.

werkt pushed a commit to werkt/bazel that referenced this issue Aug 2, 2018
Fixes bazelbuild#5599

PiperOrigin-RevId: 205794997
@jowagner
Copy link

This may be more than just cosmetic. I get this error when trying to build bazel with compile.sh. A few lines after the above error, it says:

ERROR: /build/src/main/java/com/google/devtools/build/lib/BUILD:1417:1: Building src/main/java/com/google/devtools/build/lib/bazel/BazelServer.jar () failed: Worker process returned an unparseable WorkResponse!

Did you try to print something to stdout? Workers aren't allowed to do this, as it breaks the protocol between Bazel and the worker process.

See also issue protocolbuffers/protobuf#5008

@cushon
Copy link
Contributor

cushon commented Aug 30, 2018

I'd expect those warnings to be printed to stderr, not stdout, so they shouldn't affect workers.

@jowagner
Copy link

jowagner commented Sep 1, 2018

I applied the patch 543918d to bazel-0.16.1-dist.zip and still get the "Illegal reflective access" warning followed by the error in my above comment (this time in "src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD:52:1") when running bash ./compile.sh. While the error may be unrelated to issue #5599, shouldn't the warning go away with the patch?

@jowagner
Copy link

jowagner commented Sep 1, 2018

Found issue #6009 that discusses the broken workers. Both warning and error go away when using JDK 8 instead of 11. One should read https://docs.bazel.build/versions/master/install-compile-source.html each time when compiling on a new system.

@connesso
Copy link

connesso commented Oct 4, 2018

Tried to install tensorflow with Bazel 0.17.2

[7,813 / 12,405] 32 actions running
    Compiling tensorflow/stream_executor/stream.cc [for host]; 50s local
    Compiling tensorflow/core/util/batch_util.cc [for host]; 50s local
    Compiling tensorflow/core/distributed_runtime/master_session.cc; 34s local
    Compiling tensorflow/core/common_runtime/direct_session.cc; 30s local
    Compiling tensorflow/core/kernels/remote_fused_graph_execute_utils.cc; 29s local
    Compiling tensorflow/core/kernels/argmax_op.cc; 29s local
    Compiling tensorflow/core/kernels/argmax_op_gpu.cu.cc; 29s local
    Compiling tensorflow/core/kernels/l2loss_op_gpu.cu.cc; 28s local ...

Server terminated abruptly (error code: 14, error message: '', log file: '/home/xxx/.cache/bazel/_bazel_xxx/1ac92dbf7fec9d8d5e9cfda761e288d7/server/jvm.out')

xxx@yyy:~/tensorflow$ cat /home/xxx/.cache/bazel/_bazel_xxx/1ac92dbf7fec9d8d5e9cfda761e288d7/server/jvm.out
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/xxx/.cache/bazel/_bazel_xxx/install/792a28b07894763eaa2bd870f8776b23/_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

So it doesn't seem just cosmetic...

@andreamlin
Copy link

I had run into these same errors, along with the Server terminated abruptly (error code: 14, error message: '', log file: .../jvm.out` message, but it turns out that I was just getting an out-of-memory error while running the bazel target in a CircleCI container with limited memory. After constraining bazel to run with a smaller memory footprint (tips from SO), the target built as expected.

@NelsonPython
Copy link

Ubuntu 18.04.1 Server, JDK 8
Attempting to load bazel using:
./bazel-0.18.0-installer-linux-x86_64.sh --user
worked great last week. now get

Build informations

  • [Commit] (d13df47)
    Uncompressing...WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil

Can't load bazel - any ideas?

@jlturriff
Copy link

I'm getting it also while trying to build tensorflow in my OpenSuSE Leap 15.1 system:

/usr/local/tensorflow-master
█ ./configure
WARNING: detected http_proxy set in env, setting no_proxy for localhost.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/root/.cache/bazel/_bazel_root/install/73e92e4d21505d8fa81af652d5c23b82/_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
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=159
INFO: Reading rc options for 'version' from /usr/local/tensorflow-master/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
ERROR: Unrecognized option: --experimental_repo_remote_exec
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
INFO: Invocation ID: 3fdad2d2-f19c-41b0-bbcd-dec1ce9c73eb
Traceback (most recent call last):
  File "./configure.py", line 1548, in <module>
    main()
  File "./configure.py", line 1368, in main
    _TF_MAX_BAZEL_VERSION)
  File "./configure.py", line 483, in check_bazel_version
    ['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
  File "./configure.py", line 159, in run_shell
    output = subprocess.check_output(cmd, stderr=stderr)
  File "/usr/lib64/python2.7/subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 2

@jowagner
Copy link

@jlturriff Did you try using JDK 8 (available in the openSUSE default repo) instead of 11? Also note "Illegal reflective access" is only a warning. Your output shows a proper error "Unrecognized option: --experimental_repo_remote_exec" that may have a different cause than what is discussed here. Searching for this string may help you find a solution. My guess is that your bazel is too old.

@jlturriff
Copy link

jlturriff commented Feb 28, 2020 via email

@Leslie-Fang
Copy link

I have used bazel-1.2.1 and get the same error:

ERROR: Unrecognized option: --experimental_repo_remote_exec

@jowagner
Copy link

jowagner commented Mar 9, 2020

@jlturriff and @Leslie-Fang Please open an issue "Build process requires too recent build tools" on https://github.com/tensorflow/tensorflow . The tensorflow developers are likely to close it quickly with "wontfix" but it is good to move the discussion from here to a dedicated space. Please cross-link here, e.g. by referring to this conversation in your bug report. (Github automatically creates a back-link.)

@jlturriff
Copy link

Done, except for the cross-link. (How do I do that?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants