5

Sometimes I get this exception from MongoDB Java driver 2.10.1:

java.lang.IllegalArgumentException: response too long: 1912733750
  at com.mongodb.Response.<init>(Response.java:47)
  at com.mongodb.DBPort.go(DBPort.java:124)
  at com.mongodb.DBPort.call(DBPort.java:74)
  at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:286)
  at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257)
  at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310)
  at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
  at com.mongodb.DBCursor._check(DBCursor.java:368)
  at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
  at com.mongodb.DBCursor.hasNext(DBCursor.java:484)

Obviously, my response is not that long. Actually it's rather small, there are just 1000 items in the collection, 100-500 bytes each. Why this may happen?

yegor256
  • 102,010
  • 123
  • 446
  • 597
  • 1
    Possibly related - http://stackoverflow.com/questions/12917943/why-do-i-end-up-with-java-lang-illegalargumentexception-for-casbah-java-mongod?rq=1 – Dan W Sep 12 '13 at 21:03
  • Upgrade of MongoDB java driver to version 2.11.2 does **NOT** fix the problem – yegor256 Sep 14 '13 at 09:57
  • Do you have multiple threads using the same cursor? – Asya Kamsky Jul 06 '14 at 01:33
  • 1
    The error states that your response is almost 2GB in size, if I am not mistaken. Do you mind to show us the actual query? I assume it is an aggregation you are running? – Markus W Mahlberg Aug 25 '14 at 16:00

1 Answers1

-1

As the error description says, it is caused by a server which took too long to respond to the request. Possibly this is caused by firewall settings in your server. Try to check if the server can write response out through the port you are using for your MongoDB.

haper
  • 99
  • 1
  • 9