title: Why do I end up with java.lang.IllegalArgumentException for Casbah / Java MongoDB Driver?
body: <p>I'm seeing a strange issue using the <code>casbah / java driver.</code></p>
  
  <p>I keep running into the following exception when the driver tries to create a response from mongo: </p>
  
  <pre><code>
    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)
          ...
  </code></pre>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <p><img src="https://i.stack.imgur.com/LJSyv.png" alt="enter image description here"></p>
  
  <p>The versions I'm using:</p>
  
  <p><pre><code>
   Casbah: 2.1.5.0
   Mongo Java Driver: 2.5.3
   MongoDB: 2.2
  </pre></code></p>
  
  <p>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</p>
  
  <p><strong>UPDATE:</strong> After looking at the release notes for <code>Casbah 2.1.5.0,</code> it appears that the version of the java driver being used is 2.5.3, not 2.7.3</p>