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

Properly fix "Cannot use closed connection handle" error in TestUserWorkspaceHierarchy following NXP-22403

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.3
    • Component/s: Nuxeo Drive

      Description

      Since NXP-22403, the user workspace is created by calling CoreSession#getOrCreateDocument which might commit the current transaction if the document did not exist and is therefore created.

      Before this fix, the TestUserWorkspaceHierarchy Drive test that relies on user workspaces was logging this error at teardown:

      0:36:02,649 ERROR [CoreFeature] Unable to reset repository
      org.nuxeo.ecm.core.api.NuxeoException: Cannot use closed connection handle: org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl@53a50b0a
      	at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.getSession(ConnectionImpl.java:146)
      	at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.getModel(ConnectionImpl.java:168)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.idToString(SQLSession.java:155)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.getUUID(SQLDocumentLive.java:134)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.getVersionSeriesId(SQLDocumentLive.java:442)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.getVersionsIds(SQLDocumentLive.java:518)
      	at org.nuxeo.ecm.core.versioning.DefaultVersionRemovalPolicy.removeVersions(DefaultVersionRemovalPolicy.java:77)
      	at org.nuxeo.ecm.core.api.AbstractSession.removeNotifyOneDoc(AbstractSession.java:1422)
      	at org.nuxeo.ecm.core.api.AbstractSession.removeChildren(AbstractSession.java:1334)
      	at org.nuxeo.ecm.core.test.CoreFeature.lambda$1(CoreFeature.java:285)
      	at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInNewTransaction$2(TransactionHelper.java:542)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:589)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInNewTransaction(TransactionHelper.java:555)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInNewTransaction(TransactionHelper.java:542)
      	at org.nuxeo.ecm.core.test.CoreFeature.cleanupSession(CoreFeature.java:274)
      	at org.nuxeo.ecm.core.test.CoreFeature.afterTeardown(CoreFeature.java:259)
      

      Yet by digging a little deeper, I found out that the problem was due to the fact of not unregistering the synchronization roots registered at setup.
      I suggest a proper solution by cleaning up at teardown everything that was done at setup.

        Attachments

          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 - 4 hours
                4h