Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326518 - List index problem during merge can cause a StaleReference in database even with XRef checking enabled.
Summary: List index problem during merge can cause a StaleReference in database even w...
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-29 07:31 EDT by Pascal Lehmann CLA
Modified: 2011-06-23 03:39 EDT (History)
1 user (show)

See Also:


Attachments
Testcase (5.49 KB, patch)
2010-09-29 07:35 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff
Proposed patch to fix the index problem (1.93 KB, patch)
2010-09-29 07:42 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff
Combined patch - for future reference (8.69 KB, patch)
2010-10-01 02:24 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Lehmann CLA 2010-09-29 07:31:30 EDT
Build Identifier: 4.0

With the current implementation of WithIndex.adjustAfterRemoval, list indices are not correctly 'patched' when merging using the CDODefaultMerger.ManyValued merger.

Normally, the XRef check on the server should prevent committing this, but when the indices for an ADD and REMOVE feature delta on the same list have the same index (wrongly patched), the deltas are optimized away and the changeSet contains the detached object from the REMOVE without the associated list change, which then leads to the stale reference on the server.

Reproducible: Always

Steps to Reproduce:
See testcase
Comment 1 Pascal Lehmann CLA 2010-09-29 07:35:01 EDT
Created attachment 179833 [details]
Testcase

Testcase which will throw an ObjectNotFoundException when accessing the list after commit.
Comment 2 Pascal Lehmann CLA 2010-09-29 07:42:31 EDT
Created attachment 179834 [details]
Proposed patch to fix the index problem

This patch addresses the index problem. However, it might be possible to create the situation as described in the testcase in some other way, which might create the need for more stale reference checking on the server.

NOTE: the ManyValued merger does not yet work correctly for larger lists, I might post an improved version when I finally find some time to clean up my code :)

1) The number of lines that you changed is smaller than 250.
confirmed.
2) You are the only author of these changed lines.
confirmed.
3) You apply the EPL to these changed lines.
confirmed.
Comment 3 Eike Stepper CLA 2010-10-01 02:24:57 EDT
Created attachment 180011 [details]
Combined patch - for future reference

Plus AllConfigs.java
Comment 4 Eike Stepper CLA 2010-10-01 03:09:29 EDT
Committed to HEAD
Comment 5 Eike Stepper CLA 2010-10-01 03:10:57 EDT
Committed to HEAD
Comment 6 Eike Stepper CLA 2011-06-23 03:39:23 EDT
Available in R20110608-1407