You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2011/04/08 07:47:05 UTC

[jira] [Closed] (CAY-1432) java.io.NotSerializableException when using OSCache for query cache with prefetches and persitent cache.

     [ https://issues.apache.org/jira/browse/CAY-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-1432.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1M3
                   3.0.2

I applied the patch. 

Note on possible improvement of the unit test. To guarantee correct serialization behavior, it is best to check the entire tree of objects. E.g. in the future ListWithPrefetches may wrap another list that is not serializable. So I would recommend doing actual serialization with Util.cloneViaSerialization. This will catch possible future issues with the underlying data structures. 

BTW, even with this fix, there's no guarantee that serialized cache will deserialize properly. In this case we are dealing with SHARED_CACHE that will probably work. LOCAL_CACHE may require some environment magic to be attached back to the right DataContext. I guess we'll leave this aspect out of this Jira. So just mentioning...

> java.io.NotSerializableException when using OSCache for query cache with prefetches and persitent cache. 
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: CAY-1432
>                 URL: https://issues.apache.org/jira/browse/CAY-1432
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0
>         Environment: SQL Server 2008 10.0.2531.0, OSCache 2.4, jTDS Driver 1.2.4, Kernel: 2.6.31-20-generic
>            Reporter: Gary Jarrel
>              Labels: cache, oscache
>             Fix For: 3.0.2, 3.1M3
>
>         Attachments: cay-1432.patch
>
>
> When using persistent OSCache with prefetching like:
> SelectQuery q = proto.queryWithParameters(params);
> q.addPrefetch(RichProduct.MANUFACTURER_PROPERTY);
> q.addPrefetch(RichProduct.RAW_PRODUCT_PROPERTY);
> q.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
> q.setCacheGroups("products");
> Upon execution of this query the following exception occurs:
> ERROR com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache
> [oscache] Exception persisting RichProduct/subCategory =
> <ObjectId:SubCategory, category_id=1,
> id=1>/categoryName/subCategoryName/cost
> com.opensymphony.oscache.base.persistence.CachePersistenceException:
> Unable to write
> '/tmp/cache/application/0/0/5/005126BC80FABAA4C582919EDF0B9304.cache'
> in the cache. Exception: java.io.NotSerializableException, Message:
> org.apache.cayenne.access.ListWithPrefetches
>        at com.opensymphony.oscache.plugins.diskpersistence.AbstractDiskPersistenceListener.store(AbstractDiskPersistenceListener.java:376)
>        at com.opensymphony.oscache.plugins.diskpersistence.AbstractDiskPersistenceListener.store(AbstractDiskPersistenceListener.java:238)
> <rest of stack trace removed>
> If the prefetches are removed the issue does not occur. 
> If the in memory cache is used the issue does not occur either. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira