RFR: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp [v3]

SUN Guoyun duke at openjdk.org
Thu Feb 9 07:22:42 UTC 2023


On Tue, 7 Feb 2023 08:27:57 GMT, SUN Guoyun <duke at openjdk.org> wrote:

>> Hi all,
>> When -Xcomp be used, this testcase will use more codecaches, causing the GC to be triggered early, then causing this test failed on LoongArch64 architecture.
>> 
>> This PR fix the issue, Please help review it.
>> 
>> Thanks.
>
> SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp

As you can guess, this could be a BUG in RMI framework, which has a WeakReference but not Strong-Reference var `weakImpl`, can be collected by GC in a timely manner. and there are three thread.

putTarget()         // exists in server thread
getTarget()         // exists in client thread
removeTarget()  // exists in reaper thread

So, if GC is triggered before client thread, then reaper thread must recycle impl and target. But I'm not sure what to do with variable `weakImpl` at the moment.
<pre><code class="java">
// src/java.rmi/share/classes/sun/rmi/transport/Target.java
 45 public final class Target {                                                     
 50     /** weak reference to remote object implementation */                       
 51     private final WeakRef weakImpl;   // Is it reasonable to modify it to a strong ref?
</code></pre>

-------------

PR: https://git.openjdk.org/jdk/pull/12399


More information about the core-libs-dev mailing list