Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28529

Template rendering causes OOM on MongoDB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 11.1
    • Component/s: Template Rendering

      Description

      We've got OutOfMemory exception when installing template rendering (with a custom contextExtension) on an existing nuxeo instance with MongoDB. See the stack trace:

      2020-01-14T17:26:48,271 ERROR [main] [org.nuxeo.runtime.deployment.NuxeoStarter] Exception during startup
      java.lang.OutOfMemoryError: GC overhead limit exceeded
      	at java.util.LinkedHashMap.newNode(LinkedHashMap.java:256) ~[?:1.8.0_232]
      	at java.util.HashMap.putVal(HashMap.java:631) ~[?:1.8.0_232]
      	at java.util.HashMap.put(HashMap.java:612) ~[?:1.8.0_232]
      	at org.bson.Document.put(Document.java:346) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.configuration.LazyCodec.decode(LazyCodec.java:47) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.configuration.LazyCodec.decode(LazyCodec.java:47) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.readList(DocumentCodec.java:229) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:218) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.operation.CommandResultArrayCodec.decode(CommandResultArrayCodec.java:52) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.operation.CommandResultDocumentCodec.readValue(CommandResultDocumentCodec.java:60) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:84) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:41) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.configuration.LazyCodec.decode(LazyCodec.java:47) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.BsonDocumentCodec.readValue(BsonDocumentCodec.java:101) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.operation.CommandResultDocumentCodec.readValue(CommandResultDocumentCodec.java:63) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:84) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:41) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.ReplyMessage.<init>(ReplyMessage.java:48) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.InternalStreamConnection.getCommandResult(InternalStreamConnection.java:393) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:299) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:255) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:99) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:444) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:72) ~[mongo-java-driver-3.8.1.jar:?]
      

      We can see on trace logs that we're doing a search before trying to fetch all results (behavior of CoreSession#query API). In this case we don't paginate the results as it we're trying to fetch almost the entire repository.

      The NXQL query doing that can be found there: https://github.com/nuxeo/nuxeo/blob/master/addons/nuxeo-template-rendering/nuxeo-template-rendering-core/src/main/java/org/nuxeo/template/service/TemplateMappingFetcher.java#L62.

      We need to fix this OOM, for that we may want to use the new ScrollService or just paginate the list of results.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kleturc Kevin Leturc
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: