broker leak?

17 views
Skip to first unread message

Stephane Le Dorze

unread,
Dec 19, 2009, 10:59:03 AM12/19/09
to fenix-framework
Hi!
We've bench our Fenix backed server using yourkit and found out that there's a huge amount of memory owned by the broker.

+--------------------------------------------------------------------------------------------------------------------------+------------------+---------------------+-------------------------+
|                                                           Name                                                           |     Objects      |    Shallow Size     |      Retained Size      |
+--------------------------------------------------------------------------------------------------------------------------+------------------+---------------------+-------------------------+
|  +---com.mysql.jdbc.Field                                                                                                |  425 712   15 %  |  61 302 528   28 %  |  ~  104 441 344   48 %  |
|  |                                                                                                                       |                  |                     |                         |
|  +---byte[]                                                                                                              |  425 906   15 %  |  44 169 464   20 %  |   ~  44 169 464   20 %  |
|  |                                                                                                                       |                  |                     |                         |
|  +---com.mysql.jdbc.JDBC4ResultSet                                                                                       |  141 927    5 %  |  22 708 320   11 %  |  ~  145 315 640   67 %  |
|  |                                                                                                                       |                  |                     |                         |
|  +---com.mysql.jdbc.StatementImpl                                                                                        |  141 927    5 %  |  19 302 072    9 %  |  ~  177 107 288   82 %  |
|  |                                                                                                                       |                  |                     |                         |
|  +---char[]                                                                                                              |  150 891    5 %  |  17 853 448    8 %  |   ~  17 853 448    8 %  |
|  |                                                                                                                       

It keeps growing and growing...
Is this a known issue?
Is there any way to not retain all this memory?
Thanks!
Stephane

Stephane Le Dorze

unread,
Dec 19, 2009, 6:51:20 PM12/19/09
to fenix-framework

Stephane Le Dorze

unread,
Dec 20, 2009, 9:51:31 AM12/20/09
to fenix-framework
Closing the resultSet and the statement was missing in the  updateFromTxLogsOnDatabase method of TransactionChangeLogs class
Can one please review and fix the trunk?
Thanks!
Stephane


Line Added
Line modified (I've removed the commented part)

    public static ActiveTransactionsRecord updateFromTxLogsOnDatabase(PersistenceBroker pb,
                                                                      ActiveTransactionsRecord record,
                                                                      boolean forUpdate)
            throws SQLException,LookupException {

  Connection conn = pb.serviceConnectionManager().getConnection();

  // ensure that the connection is up-to-date
  conn.commit();

  Statement stmt = null;
  ResultSet rs = null; 

  try { 

    /*Statement*/ stmt = conn.createStatement();

    // read tx logs
    int maxTxNumber = record.transactionNumber;

    /*ResultSet*/ rs = stmt.executeQuery("SELECT OBJ_OID,OBJ_ATTR,TX_NUMBER FROM FF$TX_CHANGE_LOGS WHERE TX_NUMBER > "
             + (forUpdate ? (maxTxNumber - 1) : maxTxNumber)
             + " ORDER BY TX_NUMBER"
             + (forUpdate ? " FOR UPDATE" : ""));

          // if there are any results to be processed, process them
    if (rs.next()) {
              return processAlienTransaction(pb, rs, record);
    } else {
              return record;
          }
  } finally { 
    if (rs != null) {
      rs.close();
    }
    if (stmt != null) {
      stmt.close();

Joao Cachopo

unread,
Jan 5, 2010, 5:33:18 PM1/5/10
to fenix-f...@googlegroups.com
Stephane Le Dorze <stephane...@gmail.com> writes:

> Closing the resultSet and the statement was missing in
> the  updateFromTxLogsOnDatabase method of TransactionChangeLogs class
> Can one please review and fix the trunk?

I just did it. Thanks for spotting this out and fixing it!

Best regards,
--
João Cachopo

Reply all
Reply to author
Forward
0 new messages