On Tue, 1 Dec 2026 22:49:29 GMT, Shiv Shah <[email protected]> wrote:

> instances003 disables collection on 50 instances, enables it on 25 and checks 
> that the other 25 survive a GC. To get rid of those it asks instances() again 
> and calls enableCollection() on what comes back.
> 
> JDI keeps the disable count in the ObjectReference object and holds 
> ObjectReferences only softly. If the debugger VM clears them in between, 
> instances() returns new ones with no count and enableCollection() sends 
> nothing. The 25 stay disabled. The last check then sees 25, expected 0.
> 
> Interpreted, the test's own lists keep them alive. With 
> -XX:CompileThresholdScaling=0.01 testClass is compiled early and the lists 
> are dead after their last use. With C1 only the VM also ages soft references 
> by the free space in the current heap, not the max heap. In a failing run the 
> debugger VM had an 8M heap and a young GC cleared 63 soft references between 
> the test's two forced GCs.
> 
> The last loop now uses the ObjectReferences the test kept from 
> disableCollection(). No other test under vmTestbase/nsk or 
> test/jdk/com/sun/jdi gets them again like this. JDI losing the count when an 
> ObjectReference is collected is not touched here.
> 
> ---
> 
> Testing:
> - [x] instances003, instances004, heapwalking001/002 and mixed001/002 on 
> linux-x64 debug with default options, Serial, Parallel, ZGC (instances003 
> excluded by @ requires), -Xcomp, the virtual thread factory and the failing 
> flags (20 times each, mixed001 100 more, 1 of 20 failed before). Default and 
> virtual also on linux-aarch64 debug. tier1-3 on both, only VerifyCACerts 
> fails as in mainline.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

@shivshah-oracle 
Your change (at version a177b4a3fc8ee789382eeb08c6598419a87985f9) is now ready 
to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/34172#issuecomment-7334524395

Reply via email to