cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers (JIRA)" <>
Subject [jira] Commented: (COCOON-2146) Using EventAware cache implementation breaks persistent cache restore on restart
Date Tue, 27 Nov 2007 09:17:43 GMT


Ard Schrijvers commented on COCOON-2146:

"Presumably though, if site-usage is fairly uniform, stuff that expires and is still referenced
from AbstractDoubleMapEventRegistry will get regenerated again at some fairly near point,
and replace the old entry with the new one, allowing it to be freed by the JVM? Only if you're
generating lots of unique pages or short-lived pages and caching them for a long time may
it become a 'real' problem? "

Yes, you would think you absolutely had a point here.....but, unfortunately I found out, that
the MultiHashMap doen *not* act that way !! (note, it has been a year, and i am not in a position
now to dive in the code again but from the top of my head) : 

If you have a MultiHashMap and you put something like  

m_keyMMap.put("key1", "value1");  multiple times, your map grows! you'll have 5 times "value1"
in it (obviously from a performance POV this is easy to understand)

So, exactly what you describe above, will result in OOM. Even if you have only a few possible
links, resulting in limited cachekeys, you'll run into OOM in the end....I am sorry :-) 

Anyway, the WeakReference solution is capable of being persisted, but needs some extra stuff
to be done at restart. OTOH, notification from ehcache with some listeners might be a solution
as well, though 

1) it has to be independant of ehcache
2) I still think a DoubleMap is really not the way it should be solved. I would always use
WeakReferences for these kind of problems, because the overhead of keeping the maps in sync
is not needed. 

> Using EventAware cache implementation breaks persistent cache restore on restart
> --------------------------------------------------------------------------------
>                 Key: COCOON-2146
>                 URL:
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Event Cache
>    Affects Versions: 2.1.10
>            Reporter: Ellis Pritchard
>            Assignee: Jörg Heinicke
>            Priority: Minor
>             Fix For: 2.1.11-dev (Current SVN)
>         Attachments: patch.txt
> In revision 412307 (Cocoon 2.1.10), AbstractDoubleMapEventRegistry and EventRegistryDataWrapper
were changed (without an informative SVN comment!) to use the commons MultiValueMap instead
of the MultiHashMap; I presume this was done in good faith because the latter map is deprecated
and will be removed from Apache commons-collections 4.0
> However, as a result, the persistent cache cannot be restored if the EventAware cache
implementation is used, since MultiValueMap is not Serializable! The old MultiHashMap was...
> Depending on whether StoreEventRegistryImpl or DefaultEventRegistryImpl is used, either
the event cache index is never written (ehcache doesn't store non-serializable objects on
disk), or a is thrown (and caught, causing a full cache-clear)
when attempting to restore the event cache index.
> This is Major for us, since we use Event-based caching alot, and this is causing the
*entire* cache to no-longer persist across restarts (it's been like that for 8 months, since
I upgraded Cocoon to 2.1.10 in the last week I was working here, and now I'm back, they've
actually noticed!!)
> Work-around at the moment is to down-grade AbstractDoubleMapEventRegistry and EventRegistryDataWrapper
to the 2.1.9 versions (pre-412307), which works so long as Apache-commons 3.x is still in

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

View raw message