Mirth Connect
  1. Mirth Connect
  2. MIRTH-4329

"ORA-01000: maximum open cursors exceeded" on com.mirth.connect.server.migration.ServerMigrator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.1
    • Fix Version/s: 3.7.0, 3.6.2
    • Component/s: Server
    • Environment:
      Mirth Connect 3.5.1
      Oracle 10
    • Operating System:
      Linux
    • Database:
      Oracle

      Description

      I report the following blocking error to the startup of MirthConnect 3.5.1, which occurs when a large number of codetemplates is installed (in my case 280 codetemplates),
      With this condition, the startup of the MirtConnect service crashes with the following oracle error:
      "ORA-01000: maximum open cursors exceeded"

      The problem is caused by the failure to close the statement, inside a loop, on the migrateSerializedData method of the com.mirth.connect.server.migration.ServerMigrator class.
      We have made a fix, closing the statement that performs an update query inside the loop.
      After performing a test with the same critical conditions, the error has been solved
      I report the fixed method:

      /**

      • It is assumed that for each migratable class that uses this an "id" column exists in the
      • database, which is used as the primary key when updating the row. It's also assumed that for
      • the time being, any additional columns besides the ID and serialized XML (e.g. name,
      • revision) will not change during migration.
        */
        private void migrateSerializedData(String selectSql, String updateSql, Class<?> expectedClass) {
        ObjectXMLSerializer serializer = ObjectXMLSerializer.getInstance();
        Connection connection = null;
        Statement selectStatement = null;
        PreparedStatement updateStatement = null;
        ResultSet resultSet = null;

        try {
        connection = getConnection();
        selectStatement = connection.createStatement();
        resultSet = selectStatement.executeQuery(selectSql);

        while (resultSet.next()) {
        try
        Unknown macro: { String id = resultSet.getString(1); String serializedData = resultSet.getString(2); Object obj = serializer.deserialize(serializedData, expectedClass); if (obj instanceof ExportClearable) { ((ExportClearable) obj).clearExportData(); } String migratedData = serializer.serialize(obj);​ if (!migratedData.equals(serializedData)) { updateStatement = connection.prepareStatement(updateSql); updateStatement.setString(1, migratedData); updateStatement.setString(2, id); updateStatement.executeUpdate(); } }

        catch (Exception e)

        { logger.error("Failed to migrate serialized data", e); }

        finally

        { DbUtils.closeQuietly(updateStatement); //<-------------------- FIX }


        }
        } catch (SQLException e)

        { logger.error("Failed to migrate serialized data", e); }

        finally

        { DbUtils.closeQuietly(resultSet); DbUtils.closeQuietly(selectStatement); DbUtils.closeQuietly(updateStatement); }

        }

        Activity

        Fabrizio Mioli created issue -
        Nick Rupley made changes -
        Field Original Value New Value
        Fix Version/s 3.7.0 [ 13441 ]
        Nick Rupley made changes -
        Fix Version/s 3.6.2 [ 13540 ]
        Minh Tran made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Nick Rupley made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Nick Rupley [ narupley ]

          People

          • Assignee:
            Nick Rupley
            Reporter:
            Fabrizio Mioli
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development