Uploaded image for project: 'NetarchiveSuite'
  1. NetarchiveSuite
  2. NAS-1816

Harvest DB connections are never closed

    XMLWordPrintable

Details

    Description

      We experienced reaching the maximum number of allowed connections from our pre-production PostgreSQL server when deploying NetArchive Suite 3.15.0.

      An investigation of the code, and especially DAO-related classes and DBConnect, showed that the code here assumes that connections will automatically time out, and thus does never explicitly closes connections.

      Furthermore, it is very unconventional to map a DB connection per Thread, especially if we store such a mapping in a WeakHashMap : debugging revealed that there are many still valid connections that are left open when a dead thread is garbage collected (and hence the corresponding mapping silently removed from the map).

      The proper solution is to refactor the DBConnect class to use a standard, production-quality, DB connection pool API, and ensuring in all DAO classes that connections are properly returned to the pool.

      Attachments

        Activity

          People

            ngiraud Nicolas Giraud (Inactive)
            ngiraud Nicolas Giraud (Inactive)
            Mikis Seth Sørensen Mikis Seth Sørensen (Inactive)
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 14h
                14h
                Remaining:
                Time Spent - 11h Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - 11h Remaining Estimate - 3h
                11h