You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Kristian Waagan <Kr...@Sun.COM> on 2010/06/01 22:09:40 UTC

Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

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
>    


Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

Posted by Kristian Waagan <Kr...@Sun.COM>.
On 02.06.10 10:35, Shankar Devi wrote:
> Hi Kristian,
> Thanks for the reply.
> 1. 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?
> [Devi] - yes.It is possible.
>    

In that case, how do you obtain the value?
  a) InputStream is = rs.getBinaryStream(...);
  b) Blob blob = rs.getBlob(...) ; InputStream is = blob.getBinaryStream();

> 2.  Does this bug cause database corruption?
>    

No.


-- 
Kristian

> Thanks&  Regards,
> Devi
>
>
>    


Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

Posted by Kristian Waagan <kr...@oracle.com>.
On 13.08.10 12:45, Shankar Devi wrote:
> Hi,
>         Please let me know the timeframe for when this issue is likely to be
> fixed.
>    

Hi,

I'm not sure we have identified the real problem yet.
Can you answer my latest question which I believe was:
-----
 > 1. 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?
 > [Devi] - yes.It is possible.


In that case, how do you obtain the value?
   a) InputStream is = rs.getBinaryStream(...);
   b) Blob blob = rs.getBlob(...) ; InputStream is = blob.getBinaryStream()

-----

It is impossible to say when this issue will be fixed, because:
  o nobody has committed to fix it
  o there is no runnable repro to demonstrate the bug
  o there is still no *clear* understanding of what the underlying 
problem is (answering the question might help, providing a repro would 
help for certain )

I do however have some thoughts, and I do plan to follow up on those.
In any case, the next 10.6 maintenance release hasn't been scheduled 
yet. You could of course roll your own build once the fix has been 
committed to the source repository.


Regards,
-- 
Kristian

> Thanks&  Regards,
> Devi.
>
>    


Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

Posted by Shankar Devi <sh...@sasken.com>.
Hi,
       Please let me know the timeframe for when this issue is likely to be
fixed. 
Thanks & Regards,
Devi.

-- 
View this message in context: http://old.nabble.com/Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-error-tp28678738p29427523.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

Posted by Shankar Devi <sh...@sasken.com>.
Hi Kristian,

	Is it possible to give me a time frame for when this issue is likely to be
fixed. 

Thanks & Regards,
Devi.
-- 
View this message in context: http://old.nabble.com/Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-error-tp28678738p28840567.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException' error

Posted by Shankar Devi <sh...@sasken.com>.
Hi Kristian,
Thanks for the reply.
1. 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? 
[Devi] - yes.It is possible.

2.  Does this bug cause database corruption?

Thanks & Regards,
Devi


-- 
View this message in context: http://old.nabble.com/Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-error-tp28678738p28751577.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.