On 31.05.2010 12:27, Shankar Devi wrote:
Hi Kristian,
Thanks for the very quick reply.
1. which transaction isolation level the application is running with?
[Devi] - Our application uses TRANSACTION_READ_UNCOMMITTED transaction
isolation level.
2. I'm assuming this is a multi-threaded / -user application?
[Devi] - Standalone application which supports 5 parallel operation(Multi
threaded). Maximum database Connections=20.
3. How easily is the bug reproducible?
[Devi] - Once customer has seen this issue. I have backup of customer
database. But Unable to reproduce the same.
4. looks like you may be inserting data returned by a select.Is this
correct?
Yes. Eg.,
con.prepareStatement(("insert into cfgdata_objects (objKey, objParent, name,
class, versionID, viewID, objData) " +
"select objKey, objParent, name, class, CAST (? AS BIGINT), viewID, objData
from cfgdata_objects where objKey = ? and versionID = 0");
con.prepareStatement(("insert into cfgdata_property (objKey, versionID,
viewID, objData) " +
"select objKey, CAST (? AS BIGINT), viewID, objData from cfgdata_property
where objKey = ? and versionID = 0");
5. is the source data a BLOB or a CLOB?
[Devi] - Source data is BLOB. Application is trying to insert data into
the below given table
CREATE TABLE cfgdata_objects(
objKey INT,
objParent INT,
name VARCHAR(255),
class VARCHAR(255),
versionID BIGINT DEFAULT 0,
viewID INT DEFAULT 0,
objData BLOB,
CONSTRAINT kvk_cfgdata_objects Primary Key (objKey, versionID),
CONSTRAINT pvk_cfgdata_objects Foreign Key (objParent, versionID)
REFERENCES cfgdata_objects(objKey, versionID) ON DELETE CASCADE);
CREATE TABLE cfgdata_property(
objKey INT,
versionID BIGINT DEFAULT 0,
viewID INT DEFAULT 0,
objData BLOB(2M),
CONSTRAINT kvk_cfgdata_property Foreign Key (objKey, versionID)
REFERENCES cfgdata_objects(objKey, versionID) ON DELETE CASCADE);
Does this issue is occurring due to multi thread operations with derby
database?
Thanks for the information.
This bug is triggered by concurrent access, yes. It looks like once
connection is selecting from the BLOB, and then another connection
deletes (or updates) it. Does this sound plausible for your application?
I think it is caused by a missing lock in Derby, I'll investigate a bit
more.
If your BLOBs are of limited size (or you have enough memory), it might
help you to use getBytes() instead of getBinaryStream() to work around
the issue. Depending on your application code, there might still be a
time window where the bug can be triggered. If it has only happened
once, maybe it is better to wait for a fix?
I'll post the relevant JIRA issue here when I have found / created it.
Regards,
--
Kristian
Thanks& Regards,
Devi