Issue Details (XML | Word | Printable)

Key: NUCCORE-769
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel Baldes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

ObjectManagerImp.flushInternal() might be called recursively, leading to invalid/wrong state

Created: 21/Sep/11 05:40 PM   Updated: 03/Oct/11 07:37 AM   Resolved: 22/Sep/11 06:12 PM
Component/s: Persistence
Affects Version/s: 2.2.4, 3.0.1
Fix Version/s: 3.0.2

File Attachments: 1. Text File flush.patch (2 kB)

Environment: DataNucleus 3.0.2

Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,6865


 Description  « Hide
Under certain circumstances, ObjectManagerImpl.flushInternal() can be called recursively. Before the inner call returns, it sets its internal state variable "flushing" to false.

Afterwards, the outer call of ObjectManagerImpl.flushInternal() continues executing queued operations, but with flushing = false.

This in turn leads to a problem for following add-operations for objects that have been deleted.

Please see the forum thread URL for a more detailed description.

Patch follows.

Daniel Baldes added a comment - 21/Sep/11 05:42 PM
The attached patch against the trunk / 3.0.2-SNAPSHOT fixes this problem by replacing the boolean variable "flushing" with a counter, which is increased when flushing starts, and decreased when it ends. isFlushing() now returns flushing > 0.

I'm not sure whether this technique might impose a problem elsewhere (multithreaded applications?), but it works well for me.

Daniel Baldes made changes - 21/Sep/11 05:42 PM
Field Original Value New Value
Attachment flush.patch [ 11502 ]
Andy Jefferson made changes - 22/Sep/11 06:12 PM
Affects Version/s 3.0.1 [ 11300 ]
Affects Version/s 2.2.4 [ 11182 ]
Affects Version/s 3.0.2 [ 11301 ]
Component/s Persistence [ 10200 ]
Andy Jefferson added a comment - 22/Sep/11 06:12 PM
SVN trunk has this patch. thx. Not possible to reproduce here so left as user exercise ...

Andy Jefferson made changes - 22/Sep/11 06:12 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.2 [ 11301 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 03/Oct/11 07:37 AM
Status Resolved [ 5 ] Closed [ 6 ]