• Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Java Integration
    • Labels:
    • Number of attachments :


      ObjectProxyCache is used to maintain mostly-live references to the wrappers around Java objects, so that instance variables and singletons on them linger across calls. This mostly works, but it incurs a massive performance hit for all non-coercible Java objects entering Ruby due to the extra wrappers, mapping, and weak references involved. In addition, it's not even 100% reliable; objects that leave Ruby for long enough that GC runs may find their wrappers have been culled anyway, leading to lazy, hard-to find bugs. OPC must go.

      Because this will be a breaking change for any libraries that depend on the behavior, JRuby 1.7 will deprecate it and warn against its use in the future. We will install for JRuby 1.7 (and enforce for JRuby 2.0) an opt-in policy whereby specific classes can be flagged as "persistent". For persistent classes, we will make a best effort to preserve the wrapper across calls...but no more of an effort than we currently make. We will also attempt to lazily make classes persistent if we see that they are being singletonized or have ivars defined, but with an a warning indicating that we can't guarantee other live references will see this new persistent wrapper.

      JRuby 1.7 will warn once against the use of instance variables or singletons on Java objects without first marking those classes as persistent. The warning will link to a wiki page describing the issues and the deprecation of the feature. We will also provide a flag/property users can set to switch JRuby into the 2.0 mode, to allow testing their code against what will be live in 2.0.

      When the 1.7 work has been completed, a new bug should be filed against 2.0 to make the change permanent.


        Charles Oliver Nutter made changes -
        Field Original Value New Value
        Fix Version/s JRuby 1.7.0.pre2 [ 18527 ]
        Fix Version/s JRuby 1.7.0.pre1 [ 17049 ]
        Charles Oliver Nutter made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s JRuby 1.7.0.pre1 [ 17049 ]
        Fix Version/s JRuby 1.7.0.pre2 [ 18527 ]
        Resolution Fixed [ 1 ]
        Charles Oliver Nutter made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Charles Oliver Nutter
            Charles Oliver Nutter


            • Created: