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

CoreSession leak due to long time stored references in publication trees

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.8.0-HF39, 6.0-HF28, 7.10-HF07, 8.2-SNAPSHOT, 8.3
    • Fix Version/s: 9.2
    • Component/s: Core, Publishing

      Description

      The class org.nuxeo.ecm.platform.publisher.api.AbstractBasePublicationTree which is stored by org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl.getPublicationTree(String, CoreSession, Map<String, String>, DocumentModel) in org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl.liveTree stores a CoreSession instance.

          @Override
          public PublicationTree getPublicationTree(String treeName,
                  CoreSession coreSession, Map<String, String> params,
                  DocumentModel currentDocument) throws ClientException,
                  PublicationTreeNotAvailable {
              PublicationTree tree = getOrBuildTree(treeName, coreSession, params);
              if (tree == null) {
                  return null;
              }
              if (currentDocument != null) {
                  tree.setCurrentDocument(currentDocument);
              }
              return new ProxyTree(tree, tree.getSessionId());
          }
      
          protected PublicationTree getOrBuildTree(String treeConfigName,
                  CoreSession coreSession, Map<String, String> params)
                  throws PublicationTreeNotAvailable {
              String key = computeTreeSessionId(treeConfigName, coreSession);
              PublicationTree tree;
              if (liveTrees.containsKey(key)) {
                  tree = liveTrees.get(key);
              } else {
                  tree = buildTree(key, treeConfigName, coreSession, params);
                  if (tree != null) {
                      liveTrees.put(key, tree);
                  }
              }
              return tree;
          }
      
          protected PublicationTree buildTree(String sid, String treeConfigName,
                  CoreSession coreSession, Map<String, String> params)
                  throws PublicationTreeNotAvailable {
              try {
                  PublicationTreeConfigDescriptor config = getPublicationTreeConfigDescriptor(treeConfigName);
                  Map<String, String> allParameters = computeAllParameters(config,
                          params);
                  PublicationTreeDescriptor treeDescriptor = getPublicationTreeDescriptor(config);
                  PublishedDocumentFactory publishedDocumentFactory = getPublishedDocumentFactory(
                          config, treeDescriptor, coreSession, allParameters);
                  return getPublicationTree(treeDescriptor, sid, coreSession,
                          allParameters, publishedDocumentFactory, config.getName(),
                          config.getTitle());
              } catch (PublisherException e) {
                  log.error("Unable to build PublicationTree", e);
                  return null;
              }
          }
      

      nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-publisher/src/main/resources/OSGI-INF/rendition-publisher-contrib.xml

        <extension
          target="org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl"
          point="tree">
      
          <documentation>
            PublicationTree that allows retrieving all the published Rendition documents
            in addition to the 'standard' proxies for the given document.
          </documentation>
          <publicationTree name="RenditionPublicationCoreTree"
            class="org.nuxeo.ecm.platform.rendition.publisher.RenditionPublicationCoreTree" />
      
        </extension>
      

      Similarly, the org.nuxeo.ecm.platform.publisher.impl.finder.AbstractRootSectionsFinder holds a CoreSession instance, and is stored inside org.nuxeo.ecm.platform.publisher.impl.core.RootSectionsPublicationTree which is a subclass of the org.nuxeo.ecm.platform.publisher.api.AbstractBasePublicationTree mentioned above.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h