question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[core][java][Bug] Cannot put object references onto object store with modern version of Java

See original GitHub issue

Search before asking

  • I searched the issues and found no similar issues.

Ray Component

Ray Core

Issue Severity

High: It blocks me to complete my task.

What happened + What you expected to happen

With Java 17, Java code that attempts to write an object reference to object storage fails. More specifically:

  • The code from the test case https://github.com/ray-project/ray/blob/master/java/test/src/main/java/io/ray/test/ObjectRefTransferTest.java does not work on Java 17
  • The following simpler test program also does not work:
    Ray.init();
    List<ObjectRef<String>> refsList = new ArrayList<ObjectRef<String>>();
    Ray.put(refsList);
    

In both cases, an exception similar to the following is thrown:

java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not "opens java.lang" to unnamed module @6193b845

	at io.ray.runtime.serializer.MessagePackSerializer.encode(MessagePackSerializer.java:276)
	at io.ray.runtime.serializer.Serializer.encode(Serializer.java:8)
	at io.ray.runtime.object.ObjectSerializer.serialize(ObjectSerializer.java:165)
	at io.ray.runtime.object.ObjectStore.put(ObjectStore.java:64)
	at io.ray.runtime.AbstractRayRuntime.put(AbstractRayRuntime.java:78)
	at io.ray.api.Ray.put(Ray.java:62)

This problem appears to be due to some changes to Java’s security model that were introduced in Java 9. See this post on StackOverflow for more information.

This issue is blocking me because the code I want to run does not work with Java 8.

Versions / Dependencies

Ray 1.10 MacOS 12.2.1 (Monterey) Java version info:

openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

Reproduction script

Ray.init();
List<ObjectRef<String>> refsList = new ArrayList<ObjectRef<String>>();
Ray.put(refsList);

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kfstormcommented, Mar 25, 2022

Ray Java depends on https://github.com/RuedigerMoeller/fast-serialization for serialization, and it doesn’t support Java 17 yet. See https://github.com/RuedigerMoeller/fast-serialization/issues/312 for details. @jovany-wang Could we try adding this to our codebase?

0reactions
stale[bot]commented, Sep 24, 2022

Hi again! The issue will be closed because there has been no more activity in the 14 days since the last message.

Please feel free to reopen or open a new issue if you’d still like it to be addressed.

Again, you can always ask for help on our discussion forum or Ray’s public slack channel.

Thanks again for opening the issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JDK-6187118 LTP: XMLEncoder creates valid but ... - Bug ID
JDK-5023559 - LTP: XMLEncoder emits an extraneous reference to an object with nested targets ... On Windows put the XML given in "Expected...
Read more >
I'm having trouble understanding how object references work ...
There are no references for them. That is why java distinguishes between references types (objects in heap memory) and primitive types (pure ...
Read more >
Referenceable Objects and References
You store an object with an associated reference in the directory indirectly by storing its reference. It might be useful to think of...
Read more >
Objects and references - Java Programming - Mooc.fi
First, space is reserved in the computer memory for storing object variables. Then default or initial values are set to object variables (e.g....
Read more >
Object references and copying - The Modern JavaScript Tutorial
Here we put a copy of message into phrase : ... A variable assigned to an object stores not the object itself, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found