On Tue, 7 Feb 2023 08:27:57 GMT, SUN Guoyun <d...@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

This change seems to be a bit dubious, it may solve your observed issue, but 
could be masking a deeper issue within the GC or the code generated as a result 
the -Xcomp vm arg, or an issue within TestNg, or possibly some obscure issue in 
RMI.
As I understand it, in simple terms, an object instance is not available for GC 
until there are no references held to it i.e. when it is not reachable and all 
references have been discarded.
In this scenario the test method, useExportObject, holds a reference to a 
RemoteImpl impl which has the scope of the try block, that should be sufficient 
for it to retain its liveness for it to be still available when the client 
invokes the fliterCount method.

So maybe extend the scope of the variable by moving the declaration of the 
variable impl outside of the try block, it is still assigned within the try 
block, but now its scope is the full duration of the test method, and not just 
that of the try block. As such, it should only be available for GC when the 
test method completes and it goes out of scope.

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

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

Reply via email to