[ 
https://issues.apache.org/jira/browse/GROOVY-12281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106501#comment-18106501
 ] 

ASF GitHub Bot commented on GROOVY-12281:
-----------------------------------------

testlens-app[bot] commented on PR #2820:
URL: https://github.com/apache/groovy/pull/2820#issuecomment-5365914203

   ## 🚨 TestLens detected 1 failed test 🚨
   
   Here is what you can do:
   
   1) Inspect the test failures carefully.
   2) If you are convinced that some of the tests are flaky, you can mute them 
below.
   3) Finally, trigger a rerun by checking the rerun checkbox.
   
   ### Test Summary
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/32451600816/job/96680995656?pr=2820)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | ClassInfoSoftModeStressTest > 
softModeSurvivesRealGcClearingUnderConcurrency\(\) | ❌ | 25% 🔴 |
   
   🏷️ Commit: f242c84c238ebbe8fba98fbf9490c771e1a820e4
   ▶️ Tests:  97225 executed
   🟡 Checks: 21/29 completed
   
   ### Test Failures
   
   <details>
   
   <summary><strong>ClassInfoSoftModeStressTest > 
softModeSurvivesRealGcClearingUnderConcurrency()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/32451600816/job/96680995656?pr=2820";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   org.opentest4j.AssertionFailedError: stress probe failed: dispatches=2906286 
generations=115 javaInfosCollected=33/36
   ERROR: mutated-0: IllegalStateException: mutated-0 observed gen 21 after 
already seeing 22
    ==> expected: <0> but was: <1>
        at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628)
        at 
org.codehaus.groovy.reflection.ClassInfoSoftModeStressTest.softModeSurvivesRealGcClearingUnderConcurrency(ClassInfoSoftModeStressTest.groovy:53)
   ```
   
   |expected|actual|
   |---|---|
   |<s>0</s>|<b>1</b>|
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 ClassInfoSoftModeStressTest > 
softModeSurvivesRealGcClearingUnderConcurrency\(\) <!

> Investigate mitigating class-loader pinning by ClassInfo.globalClassValue 
> under the default ClassValue implementation
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12281
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12281
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>         Attachments: GROOVY-12281-Assessmentv2.pdf
>
>
> Follow-up from review discussion on [PR 
> #2798|https://github.com/apache/groovy/pull/2798] (GROOVY-12142), preserving 
> the analysis from that review. A {{ClassValue}} realizes the chain _key class 
> → association → value → everything reachable from it_, and the association 
> lives as long as the key class 
> ([JDK-8136353|https://bugs.openjdk.org/browse/JDK-8136353], working as 
> intended). The {{ClassValue}} implementation class itself prevents no 
> unloading; what matters is the key's origin: a Groovy-loaded key class dies 
> with Groovy's loader (fine), but a JDK/platform key class is effectively 
> immortal, so any value reachable from it that was loaded by Groovy's loader 
> pins that loader forever. Indirection counts — a JDK-typed value (e.g. an 
> {{ArrayList}}) whose _elements_ are Groovy-loaded re-creates the pin one 
> level down.
> {{ClassInfo.globalClassValue}} is static with unknown keys, including 
> platform classes ({{String}} receives a {{ClassInfo}} in essentially every 
> Groovy program), so the default {{ClassValue}} path pins the loader; today's 
> only remedy is the global {{groovy.use.classvalue=false}} escape hatch, which 
> trades away the per-class fast path for all keys.
> The general mitigation — {{SoftReference}}-wrapped values with a 
> check-remove-recompute protocol — requires that recomputation be legal, and 
> for {{ClassInfo}} it is not in general: a {{ClassInfo}} can carry 
> non-recomputable state (modified metaclasses, category state), so a 
> softly-collected value could silently discard user metaclass customizations. 
> Approaches to investigate:
> * soft values while a {{ClassInfo}} is pristine, hardening the reference on 
> first mutation — only classes with customized metaclasses would then pin, a 
> far smaller set;
> * per-key policy: platform-loader keys get soft/map treatment, Groovy-loader 
> keys stay strong (the key-origin rule applied mechanically);
> * splitting {{ClassInfo}} into recomputable and stateful parts;
> * revisiting whether the map-based implementation should become the default, 
> with {{ClassValue}} as the opt-in fast path.
> Recompute cost and dispatch-path performance need measurement for any 
> candidate.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to