Java Driver
  1. Java Driver
  2. JAVA-119

java driver exception on dbcursor hasnext

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major - P3 Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux ubuntu
    • Operating System:
      Linux
    • # Replies:
      3
    • Last comment by Customer:
      false

      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?

      1. tmp.bson
        10 kB
        hadar

        Activity

        Hide
        Eliot Horowitz
        added a comment -

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

        Show
        Eliot Horowitz
        added a comment - the bson you attached is corrupt. how did you insert it? this certainly isn't a dbcursor issue at least
        Hide
        hadar
        added a comment -

        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.

        Show
        hadar
        added a comment - 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.
        Hide
        Eliot Horowitz
        added a comment -

        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?

        Show
        Eliot Horowitz
        added a comment - 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?

          People

          • Assignee:
            Eliot Horowitz
            Reporter:
            hadar
            Participants:
            Last commenter:
            Barrie Segal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              3 years, 45 weeks, 2 days ago
              Date of 1st Reply: