You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Deepa Remesh (JIRA)" <de...@db.apache.org> on 2006/02/21 23:17:24 UTC

[jira] Created: (DERBY-1021) Perform cleanup actions which require synchronization outside the finalizer

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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-1021) Perform cleanup actions which require synchronization outside the finalizer

Posted by "Deepa Remesh (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1021?page=all ]
     
Deepa Remesh closed DERBY-1021:
-------------------------------

    Fix Version: 10.2.0.0
     Resolution: Fixed

This issue has been partly resolved by check-ins for DERBY-1103. A new sub-task (DERBY-1104) is opened for further work.

> 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
>      Fix For: 10.2.0.0

>
> 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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira