41

I'm seeing a strange issue using the casbah / java driver.

I keep running into the following exception when the driver tries to create a response from mongo:


  Oct 16, 2012 10:45:07 AM com.mongodb.DBTCPConnector$MyPort error
  SEVERE: MyPort.error called
  java.lang.IllegalArgumentException: response too long: 1634610484
    at com.mongodb.Response.(Response.java:40)
    at com.mongodb.DBPort.go(DBPort.java:110)
    at com.mongodb.DBPort.go(DBPort.java:75)
    at com.mongodb.DBPort.call(DBPort.java:65)
    at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:201)
    at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
    at com.mongodb.DBCursor._check(DBCursor.java:354)
    at com.mongodb.DBCursor._hasNext(DBCursor.java:484)
    at com.mongodb.DBCursor.hasNext(DBCursor.java:509)
    at com.mongodb.casbah.MongoCursorBase$class.hasNext(MongoCursor.scala:73)
    at com.mongodb.casbah.MongoCursor.hasNext(MongoCursor.scala:497)
    at scala.collection.Iterator$class.foreach(Iterator.scala:660)
    at com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:497)
        ...

This seems to be happening at random, even in cases where mongo shouldn't be returning any results from the query. The size reported is inconsistent and normally way larger than it should or could be.

I'm guessing this is probably some form of corruption with the response. I've had a difficult time making heads or tails of this problem using Wireshark, but I consistently find that the request/response chain leading up to the query whose response throws this error has "TCP Window Full" response coming from MongoDB:

enter image description here

The versions I'm using:


 Casbah: 2.1.5.0
 Mongo Java Driver: 2.5.3
 MongoDB: 2.2

I'd greatly appreciate it if anyone could give any advice on what I may potentially be doing wrong or any pointers on how to further debug this issue

UPDATE: After looking at the release notes for Casbah 2.1.5.0, it appears that the version of the java driver being used is 2.5.3, not 2.7.3

Praveen Vinny
  • 2,372
  • 6
  • 32
  • 40
Bryan
  • 1,431
  • 1
  • 14
  • 19
  • current version of Java driver for MongoDB is 2.9.1 I believe. One thing you might check is are you doing a lot of writes? (inserts or updates) If so what level of writeConcern are you using? – Asya Kamsky Oct 21 '12 at 00:47
  • 17
    The code in question is: `if ( _len > ( 32 * 1024 * 1024 ) ) throw new IllegalArgumentException( "response too long: " + _len );` where _len is the first four bytes of the response sent from the server. So it's either network corruption, bug in the server or driver. Is there anything in the server logs? 2.9.0 is the current stable version of the driver, there is a bug in (2.9.1)[https://jira.mongodb.org/browse/JAVA-660]. 2.9.2 will contain a fix and should be released later this week. Can you upgrade the driver to either 2.9.0 or 2.9.2 this week? – Mark Hillick Oct 22 '12 at 12:26

2 Answers2

3

The version of the Java driver you're using is not compatible with MongoDB 2.2. You should be using at least 2.9.3, if not 2.10 or higher. There's no guarantee a driver upgrade will fix your problem, but it should be a first step.

https://support.mongolab.com/entries/22631012-which-drivers-support-mongodb-2-2

jared
  • 5,369
  • 2
  • 21
  • 24
1

How big is your JSON object? See if that big object is supported by the version of mongodb.

Prateek
  • 523
  • 2
  • 13