[JAVA-119] java driver exception on dbcursor hasnext Created: 09/Jun/10  Updated: 09/Jun/10  Resolved: 09/Jun/10

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

Type: Bug Priority: Major - P3
Reporter: hadar Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux ubuntu


Attachments: File tmp.bson    

 Description   

I'm using morphia for object mappings.
I have no problem inserting objects to database or pulling them via
the shell.
When using the java driver both 1.4 and 2.0rc
For some objects i get the following exception:
Exception in thread "main" com.mongodb.MongoInternalException:
couldn't get next element
at com.mongodb.DBCursor.hasNext(DBCursor.java:402)
at
knil.attributeGraphIndexer.postAnalytics.MongoTest.run2(MongoTest.java:
90)
at
knil.attributeGraphIndexer.postAnalytics.MongoTest.main(MongoTest.java:
100)
Caused by: com.mongodb.MongoException: invalid bson? size:134217743
remaining: 8077
at com.mongodb.ByteDecoder.decodeNext(ByteDecoder.java:191)
at com.mongodb.ByteDecoder.decodeNext(ByteDecoder.java:254)
at com.mongodb.ByteDecoder.decodeNext(ByteDecoder.java:235)
at com.mongodb.ByteDecoder.readObject(ByteDecoder.java:104)
at com.mongodb.DBApiLayer$SingleResult.<init>(DBApiLayer.java:407)
at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:299)
at com.mongodb.DBCursor._check(DBCursor.java:253)
at com.mongodb.DBCursor._hasNext(DBCursor.java:374)
at com.mongodb.DBCursor.hasNext(DBCursor.java:399)
... 2 more

attached is a db with the object

any ideas what is wrong?



 Comments   
Comment by Eliot Horowitz (Inactive) [ 09/Jun/10 ]

The shell is handling the corruption better.
Its not really corruption, its invalid bson

Can you reproduce this?
i.e. send the morphia code that generated the problem?

Comment by hadar [ 09/Jun/10 ]

well as I reported I originaly inserted the object to the db using a java object via morphia.
then i did db.tmp.insert(db.objects.findOne("_id":<id here>));
so the tmp db holds only one object. and then I did a dump.
how can the db be corrupted if I can do db.tmp.find() and it lists the object perfectly.

Comment by Eliot Horowitz (Inactive) [ 09/Jun/10 ]

the bson you attached is corrupt.
how did you insert it?
this certainly isn't a dbcursor issue at least

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