DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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

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:,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.

Sort Order: Ascending order - Click to sort in descending order
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.

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 ...