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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2007/05/26 10:54:16 UTC

[jira] Created: (DERBY-2700) Invalid entries in the cache manager are not garbage collected until the CachedItem is reused

Invalid entries in the cache manager are not garbage collected until the CachedItem is reused
---------------------------------------------------------------------------------------------

                 Key: DERBY-2700
                 URL: https://issues.apache.org/jira/browse/DERBY-2700
             Project: Derby
          Issue Type: Bug
          Components: Services
    Affects Versions: 10.2.2.0, 10.2.1.6, 10.3.0.0
            Reporter: Knut Anders Hatlen
         Assigned To: Knut Anders Hatlen


When an entry in the cache manager becomes invalid (for instance because a table is dropped), it cannot be garbage collected because we only set the valid_ field in CachedItem to false. We should also set entry to null to make the Cacheable eligible for garbage collection. Currently, invalid cached objects cannot be garbage collected until their CachedItems are reused. This causes Derby to hold on to resources too long, and can in the worst case lead to an OutOfMemoryError.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-2700) Invalid entries in the cache manager are not garbage collected until the CachedItem is reused

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-2700.
-------------------------------------

    Resolution: Invalid

Closing the issue as 'invalid'. I had missed that the cache manager reuses Cacheables, not only CachedItems. Cacheable.clearIdentity() does what it's supposed to do (like clearing references to invalidated statements). Buffers containing page data are not nulled out, but as long as they can be reused later, I think that's fine (and the user also has the possibility to tune the maximum number of pages/bytes to cache). Sorry about the noise!

> Invalid entries in the cache manager are not garbage collected until the CachedItem is reused
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2700
>                 URL: https://issues.apache.org/jira/browse/DERBY-2700
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>         Attachments: 2700.diff
>
>
> When an entry in the cache manager becomes invalid (for instance because a table is dropped), it cannot be garbage collected because we only set the valid_ field in CachedItem to false. We should also set entry to null to make the Cacheable eligible for garbage collection. Currently, invalid cached objects cannot be garbage collected until their CachedItems are reused. This causes Derby to hold on to resources too long, and can in the worst case lead to an OutOfMemoryError.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2700) Invalid entries in the cache manager are not garbage collected until the CachedItem is reused

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-2700:
--------------------------------------

    Attachment: 2700.diff

The attached patch (2700.diff) sets CachedItem.entry to null when it is marked as invalid. I have not run the full regression test suite, but I have verified (by monitoring the process with JConsole) that Derby is able to free a lot more memory after dropping a table with this patch.

> Invalid entries in the cache manager are not garbage collected until the CachedItem is reused
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2700
>                 URL: https://issues.apache.org/jira/browse/DERBY-2700
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>         Attachments: 2700.diff
>
>
> When an entry in the cache manager becomes invalid (for instance because a table is dropped), it cannot be garbage collected because we only set the valid_ field in CachedItem to false. We should also set entry to null to make the Cacheable eligible for garbage collection. Currently, invalid cached objects cannot be garbage collected until their CachedItems are reused. This causes Derby to hold on to resources too long, and can in the worst case lead to an OutOfMemoryError.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2700) Invalid entries in the cache manager are not garbage collected until the CachedItem is reused

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499296 ] 

Knut Anders Hatlen commented on DERBY-2700:
-------------------------------------------

Thinking more about it, this is perhaps what Cacheable.clearIdentity() is supposed to take care of. clearIdentity() seems to take a more minimalistic approach, only clearing data that definitely cannot be reused when setting a new identity. I think it makes some sense to clear the entire Cacheable when it's invalidated, since it shouldn't happen too frequently and one don't know whether it will or can be reused later (for instance, because of different page sizes), but I'm not convinced it's the best solution.

> Invalid entries in the cache manager are not garbage collected until the CachedItem is reused
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2700
>                 URL: https://issues.apache.org/jira/browse/DERBY-2700
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>         Attachments: 2700.diff
>
>
> When an entry in the cache manager becomes invalid (for instance because a table is dropped), it cannot be garbage collected because we only set the valid_ field in CachedItem to false. We should also set entry to null to make the Cacheable eligible for garbage collection. Currently, invalid cached objects cannot be garbage collected until their CachedItems are reused. This causes Derby to hold on to resources too long, and can in the worst case lead to an OutOfMemoryError.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.