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

Clears the PooledDataSourceRegistry on deactivation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.2, 2021.43
    • Component/s: Runtime
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #95
    • Story Points:
      0

      Description

      The PooledDataSourceRegistry isn't cleared on the Nuxeo component deactivation, this doesn't impact the Nuxeo Server while running in production, as the deactivation is only performed when shutting down the server, but it impacts our tests as each time there's a @Deploy annotation on a test method, a full Nuxeo Runtime re-start is performed (stop -> deactivate -> activate -> start).

      By not clearing this registry, we keep DataSources element in the heap, which contain DB opened connections. So when the GC is not executed, we may meet a connection exhaustion.

      The following stacktrace is thrown in such cases:

      	Suppressed: org.nuxeo.ecm.core.api.NuxeoException: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections
      		at org.nuxeo.ecm.core.test.StorageConfiguration.initJDBC(StorageConfiguration.java:152)
      		at org.nuxeo.ecm.core.test.StorageConfiguration.init(StorageConfiguration.java:120)
      		at org.nuxeo.ecm.core.test.CoreFeature.start(CoreFeature.java:197)
      		at org.nuxeo.runtime.test.runner.FeaturesRunner.lambda$start$6(FeaturesRunner.java:266)
      		at org.nuxeo.runtime.test.runner.FeaturesRunner.apply(FeaturesRunner.java:300)
      		... 25 more
      	Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections
      		at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
      		at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2787)
      		at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:173)
      		at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:290)
      		at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
      		at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
      		at org.postgresql.Driver.makeConnection(Driver.java:402)
      		at org.postgresql.Driver.connect(Driver.java:261)
      		at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
      		at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
      		at org.nuxeo.ecm.core.storage.sql.DatabasePostgreSQL.setUp(DatabasePostgreSQL.java:67)
      		at org.nuxeo.ecm.core.test.StorageConfiguration.initJDBC(StorageConfiguration.java:150)
      		... 29 more
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: