Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are running mongo for 4 months so far , But lately I am seeing a lot of

SocketException handling request, closing client connection: 9001 socket exception [2] server []

How can I know the cause of this error ? Is it related to code issue or administrator configuration?

We have Fedora 16 server , mongo version 2.0.7

share|improve this question

First off, take a look and follow the steps outlined here:

Next, look for any ulimit issues on the target host (a new file descriptor is required for a new socket and can cause the error):

Finally, there are a couple of issues related to idle connections being used when they should not be, and that can also contribute to this type of issue:

Until SERVER-5632 is complete, the only remedy here is to flush the connections by restarting the mongod/mongos processes.

share|improve this answer

I got this to stop happening by adding a batchSize option arg to my cursor query

e.g. before:

var cursor = db.collection('images').find( {}, {"_id": 1} ).sort({"_id": 1});


var cursor = db.collection('images').find( {}, {"_id": 1} ).sort({"_id": 1}).batchSize(1000);

This made it run smoother (not as many start/stops) and with fewer nasty messages. None in fact.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.