db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepa Remesh (JIRA)" <derby-...@db.apache.org>
Subject [jira] Created: (DERBY-1021) Perform cleanup actions which require synchronization outside the finalizer
Date Tue, 21 Feb 2006 22:17:24 GMT
Perform cleanup actions which require synchronization outside the finalizer

         Key: DERBY-1021
         URL: http://issues.apache.org/jira/browse/DERBY-1021
     Project: Derby
        Type: Bug
  Components: Network Client  
 Environment: Derby Network Client Driver
    Reporter: Deepa Remesh

In client driver, finalize() method in Statement class involves synchronized calls. This may
block the finalizer thread and potentially the JVM. In general, avoid any synchronized operation
from finalizer. Embedded driver performs the cleanup actions outside the finalizer. See EmbedPreparedStatement.finalize.
A similar mechanism needs to be used in client driver. 

The existing code in client's finalize() methods do not cause any problems so far because
finalize was getting called only after explicit close of statement objects. So the code in
the finalizer does not get exercised. Once the memory leaks are removed as part of DERBY-210
(https://issues.apache.org/jira/browse/DERBY-210), the finalizer can get called as soon as
the application dereferences a statement object.

To be able to proceed with DERBY-210, patch4 in DERBY-210 changes the finalizer method to
not do any synchronized actions. It removes sending of any network messages from finalizer:
1) Removes sending commit messages to network server
2) Removes sending CLSQRY to cleanup all result sets of a statement on network server since
the cleanup of result sets on network server will happen when a statement is re-used. 
Kathey pointed out some scenarios and said that we still need to do 2) - we need to send CLSQRY
for all result sets of a statement when the statement is finalized. Sending CLSQRY command
needs to be synchronized. Hence, we need to implement a mechanism similar to what is done
in embedded driver finalizers.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message