Details

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

      Description

      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.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        As of pre1, we warn and point users toward https://github.com/jruby/jruby/wiki/Persistence, so this is resolved. Will file a new issue against 2.0 to disable persistent wrappers by default.

        Show
        Charles Oliver Nutter added a comment - As of pre1, we warn and point users toward https://github.com/jruby/jruby/wiki/Persistence , so this is resolved. Will file a new issue against 2.0 to disable persistent wrappers by default.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Charles Oliver Nutter
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: