Andrus Adamchik created CAY-2096:
------------------------------------
Summary: Potential race condition resolving hollow object
Key: CAY-2096
URL: https://issues.apache.org/jira/browse/CAY-2096
Project: Cayenne
Issue Type: Bug
Affects Versions: 3.1
Reporter: Andrus Adamchik
Assignee: Andrus Adamchik
This was reported by one of the users. When reading properties of a HOLLOW
object, the following exception is thrown:
Caused by: org.apache.cayenne.FaultFailureException: [v.3.1 Sep 20 2014
14:06:21] Error resolving fault for ObjectId: <ObjectId:MyObject, id=12345> and
state (hollow). Possible cause - matching row is missing from the database.
at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:226)
at
org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:180)
Note that this exception is not really FaultFailure, as the data was returned
from the DB, but the object still remained HOLLOW at the point where the
exception is thrown. While researching the issue, we noticed that the object is
reset to hollow via a Cayenne event thread. Presumably inside
DataRowUtils.refreshObjectWithSnapshot .. So this is a race condition between
the thread reading object properties and event thread. (This is why I hate
snapshot events!)
One possible solution would be to check for HOLLOW status and retry resolving
the object N times (essentially optimistic approach instead of locking big
chunks of code).
But first we need to understand what types of SnapshotEvents actually turn
object into the HOLLOW state. I don't think this happens under normal
circumstances.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)