Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ServerSession cache coordination problem

Seems to be a bug, and the same issue as,

https://bugs.eclipse.org/bugs/show_bug.cgi?id=276955

Please add your information to the bug and vote for it.

I'm not sure why it occurs, the new object should get its change set build
if referenced from a change set being serialized.  But, this does not seem
to be working correctly.

The workaround is to use either SEND_NEW_OBJECTS_WITH_CHANGES or
INVALIDATE_CHANGED_OBJECTS.


Blackwing wrote:
> 
> Hello,
> 
> I'm experiencing a problem while using session coordination feature of
> Eclipselink in a distributed environment on Weblogic 10 cluster. Let's
> take the following example. I have two persistent classes in a classical
> parent-child relationship:
> 
> class Parent {
> 
>   private Set<Child> children;
>   
>   //other fields and methods
> }
> 
> class Child {
> 
>   //parent of type Parent
>   private ValueHolderInterface parent = new ValueHolder();
>   
>   //other fields and methods
> }  
>  
> Collection of children in class Parent is an indirect set (lazy
> initialization strategy). Changes in ServerSession cache are replicated
> between two nodes using JMS transport and default
> ClassDescriptor.SEND_OBJECT_CHANGES propagation strategy.
> 
> Recently I discovered that in certain circumstances broken instances of
> class Child can be found in ServerSession cache. One of possible paths
> that leads to such state is given below:
> 
> 1. Instance of class Parent is loaded into ServerSession cache on Node1.
> 2. Lazy collection of children in cached instance of class Parent on Node1
> is loaded into memory from database.
> 3. New instance of class Child is created and assosciated with existing
> instance of class Parent on Node2.
> 4. During the process of UnitOfWork state merging (on Node2) a JMS message
> is sent to Node1. This message describes changes that must be propagated
> to cache on Node1 in order to maintain consistency of data. Unfortunately
> UnitOfWorkChangeSet object which is sent over JMS is incomplete and that
> leads to corruption of cache on Node1.
> 
> ClassDescriptor.SEND_OBJECT_CHANGES mode of propagation ensures that
> message is sent to remote node only if some attributes of existing objects
> are changed. In my case the modification of children collection in
> existing instance of class Parent triggers cache synchronization message.
> This message contains ChangeSet object for a newly created instance of
> class Child. However this ChangeSet is not fully populated (it contains
> ChangeRecords only for aggregate fields of class Child) and if collection
> of children in cached instance of class Parent on Node1 is initialized
> then a broken instance of class Child is created and merged into
> ServerSession cache on Node1. Only primary key and aggregate fields are
> populated, other attributes are NULLs. In consequence when I get this
> instance of class Child from cache on Node1 then I encounter
> NullPointerExceptions accessing null attributes.
> 
> Currently I'm using Eclipselink 2.1.0. The problem started to raise after
> switch from Toplink 10.1.3. I suppose that it might be related to this
> optimization in Eclipselink:
> http://wiki.eclipse.org/EclipseLink/DesignDocs/221546%281.1%29#Avoiding_ChangeSets_for_New_Objects.
> ChageSets for new objects are not populated but they are sent to remote
> nodes in broken state. I can workaround this problem by changing cache
> propagation strategy or maybe also by setting the
> ClassDescriptor.shouldUseFullChangeSetsForNewObjects flag to true (not
> tested however) but I wonder if this situation is a bug or maybe I miss
> something. 
> 
> Thanks in advance for help,
> Best regards,
> Krzysiek
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/ServerSession-cache-coordination-problem-tp31302725p31333966.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top