[JAVA-86] java.lang.IndexOutOfBoundsException Error Created: 06/Feb/10  Updated: 11/Jul/10  Resolved: 11/Jul/10

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 1.2
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: Serge Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File mongodb.png    

 Description   

java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:514)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:209)
at com.mongodb.RawDBObject._readCStr(RawDBObject.java:112)
at com.mongodb.RawDBObject$Element.<init>(RawDBObject.java:181)
at com.mongodb.RawDBObject$ElementIter.next(RawDBObject.java:312)
at com.mongodb.RawDBObject.findElement(RawDBObject.java:156)
at com.mongodb.RawDBObject.get(RawDBObject.java:49)
at com.mongodb.DBTCPConnector._getError(DBTCPConnector.java:216)
at com.mongodb.DBTCPConnector._call(DBTCPConnector.java:170)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:156)
at com.mongodb.DBApiLayer.doQuery(DBApiLayer.java:67)
at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:311)
at com.mongodb.DBCollection.findOne(DBCollection.java:310)
at com.mongodb.DBCollection.findOne(DBCollection.java:300)

Mongo DB : starting : pid = 0 port = 27017 dbpath = T:\mongodb master = 0 slave = 0 64-bit
db version v1.2.2, pdfile version 4.5
git version: 8a4fb8b1c7cb78648c55368d806ba35054f6be54
sys info: windows (6, 0, 6002, 2, 'Service Pack 2') BOOST_LIB_VERSION=1_39

java driver 1.2 (same error with v1.0)



 Comments   
Comment by Eliot Horowitz (Inactive) [ 11/Jul/10 ]

Not sure there is much to do with corrupt bson...
Will think about

Comment by Serge [ 15/Feb/10 ]

after start with --repair all work fine.

PS. May be need output with more informative message about broken data in DB?

Comment by Eliot Horowitz (Inactive) [ 15/Feb/10 ]

Oh - well that makes more sense at least.
Did the server crash at some point?
Can you start with --repair?

Comment by Serge [ 15/Feb/10 ]

java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:514)
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:121)
at com.mongodb.RawDBObject._readCStr(RawDBObject.java:112)
at com.mongodb.RawDBObject$Element.<init>(RawDBObject.java:192)
at com.mongodb.RawDBObject$ElementIter.next(RawDBObject.java:323)
at com.mongodb.RawDBObject.findElement(RawDBObject.java:167)
at com.mongodb.RawDBObject.get(RawDBObject.java:49)
at com.mongodb.DBTCPConnector._getError(DBTCPConnector.java:216)
at com.mongodb.DBTCPConnector._call(DBTCPConnector.java:170)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:156)
at com.mongodb.DBApiLayer.doQuery(DBApiLayer.java:67)
at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:311)
at com.mongodb.DBCollection.findOne(DBCollection.java:344)
at com.mongodb.DBCollection.findOne(DBCollection.java:333)

I try query object via command line (mongo.exe) an got an error:
> db.pages.find(

{ url : "xxx" }

)
error:BSONElement: bad type 47

and

> db.repairDatabase()
Mon Feb 15 23:24:37 Assertion: BSONElement: bad type 47
Mon Feb 15 23:33:18 User Exception (shellhelp1) exec failed
exception: (shellhelp1) exec failed

Comment by Eliot Horowitz (Inactive) [ 15/Feb/10 ]

just pushed a change to github, can you try it?

Comment by Serge [ 14/Feb/10 ]

All of stack traces above was made with jdk1.6_14

with 1.6_18 same error

Comment by Serge [ 14/Feb/10 ]

with driver builds from git head:

java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:514)
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:121)
at com.mongodb.RawDBObject._readCStr(RawDBObject.java:112)
at com.mongodb.RawDBObject$Element.<init>(RawDBObject.java:192)
at com.mongodb.RawDBObject$ElementIter.next(RawDBObject.java:323)
at com.mongodb.RawDBObject.findElement(RawDBObject.java:167)
at com.mongodb.RawDBObject.get(RawDBObject.java:49)
at com.mongodb.DBTCPConnector._getError(DBTCPConnector.java:216)
at com.mongodb.DBTCPConnector._call(DBTCPConnector.java:170)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:156)
at com.mongodb.DBApiLayer.doQuery(DBApiLayer.java:67)
at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:311)
at com.mongodb.DBCollection.findOne(DBCollection.java:344)
at com.mongodb.DBCollection.findOne(DBCollection.java:333)

I dont understood what is it:
static boolean DEBUG = Boolean.getBoolean( "DEBUG.DBJSO" );

and simple change to
static boolean DEBUG = true;

result is:
name [_id] type [7]
name [url] type [2]
name [title] type [2]
name [date] type [9]
name [content] type [2]
java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:514)
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:121)
at com.mongodb.RawDBObject._readCStr(RawDBObject.java:112)
at com.mongodb.RawDBObject$Element.<init>(RawDBObject.java:192)
at com.mongodb.RawDBObject$ElementIter.next(RawDBObject.java:323)
at com.mongodb.RawDBObject.findElement(RawDBObject.java:167)
at com.mongodb.RawDBObject.get(RawDBObject.java:49)
at com.mongodb.DBTCPConnector._getError(DBTCPConnector.java:216)
at com.mongodb.DBTCPConnector._call(DBTCPConnector.java:170)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:156)
at com.mongodb.DBApiLayer.doQuery(DBApiLayer.java:67)
at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:311)
at com.mongodb.DBCollection.findOne(DBCollection.java:344)
at com.mongodb.DBCollection.findOne(DBCollection.java:333)

In attached file screenshot just before throw an exception. As you can see capacity is not equals to limit

Comment by Eliot Horowitz (Inactive) [ 12/Feb/10 ]

i can't reproduce this.
i just pushed some more debugging - if you could build the jar from master and try again would be appreciative.

Comment by auto [ 12/Feb/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: debugging for JAVA-86
http://github.com/mongodb/mongo-java-driver/commit/7aac2d20ac514e966406542917553d3faba79d17

Generated at Thu Feb 08 08:51:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.