Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-511

JRuby BSON leaks entire ruby runtimes until server restart

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.8.1
    • Affects Version/s: 1.7.0, 1.8.0
    • Component/s: None
    • None

      The Java native code here keeps a HashMap of Ruby runtimes in a static final variable: https://github.com/mongodb/mongo-ruby-driver/blob/ce6915fca98dabd264f6c15953a504c209c95132/ext/java/src/org/jbson/RubyBSONCallback.java#L42

      This means entire Ruby runtimes will NEVER be GC'd. Many JRuby servers don't restart the entire server process, but rather create a new Ruby runtime during a redeployment; TorqueBox, for instance, can run multiple apps, so redeploying one doesn't necessitate the process itself restart.

      The result of this can be pretty devastating for anyone trying to use MongoDB and JRuby. It's pretty easy to run out of memory when copies of your JRuby app are never up for garbage collection.

            Assignee:
            brandon.black@10gen.com Brandon Black
            Reporter:
            dougtmayer Doug Mayer
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: