Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1355

Driver registers itself in DriverManager even when only a DataSource/Pool is used, pinning the class loader

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 3.5.11
    • Other
    • None

    Description

      see PR
      in 3.x branch, org.mariadb.jdbc.Driver registers itself in java.sql.DriverManager from a static initializer:

      static {
        DriverManager.registerDriver(new Driver());
      }
      

      DriverManager keeps a strong reference to every registered driver for the lifetime of the JVM (until deregisterDriver() is explicitly called). That reference keeps the driver's Class alive, and when the driver class was loaded by an application's own class loader rather than a shared one keeps that entire class loader from being garbage collected once the application is redeployed or undeployed.

      Impact: any application using MariaDbDataSource or the built-in pool inside a container that supports hot redeploy accumulates one pinned class loader per redeploy.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.