AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:49939

1,856 views
Skip to first unread message

chetan sindhe

unread,
Jul 1, 2017, 1:09:34 AM7/1/17
to mongodb-user
Trying to insert about 1000 documents into mongoDB on intervals of every 10sec.
After processing for about a minute, timeout exceptions are seen.

**Error**
AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:49939

**Connection to Mongo**

 mongoDb.connect(config.db.url, function (err, conn) {
      console.log('mongodb connected')
      db = conn;
    });

mongodb connect is called only once in the application lifetime.  db is used through all bulk operations. 

**Mongo document structure**
Document structure is fairly simple as shown below. I even tried having an index on accCode. Tried upsert and bulkinsert too. I even set connectTimeoutMS=90000 on the mongo connect url.


**Query**
//forEach of 1000 items
bulk.find({ accCode: acCode}).upsert().updateOne({ $push: { EQ: item} });
//end For

bulk.exec({...});


[Document structure][1]



**Node Version**: 6.9.4
**MongoDB Version**: 3.4.5
**mongodb node driver**: 2.2.27

Kevin Adistambha

unread,
Jul 17, 2017, 2:50:25 AM7/17/17
to mongodb-user

Hi,

It’s been a while since you posted this question. Have you found out what’s happening yet?

The AssertionException message you observed could be caused by intermittent issues on the network layer, or the application closes its connection to the database before MongoDB has a chance to respond (e.g. due to the query exceeding a timeout).

Note that the connectTimeoutMS setting does not regulate per-query timeout. To paraphrase from the linked page, the setting governs “The time in milliseconds to attempt a connection before timing out”.

If you’re still having this issue, could you post:

  • Your topology (standalone, replica set, or sharded cluster)
  • Your OS version
  • Any error message by the node driver that corresponds to these AssertionException messages
  • Is there any pattern leading to the error that you can observe?

Please also ensure that your MongoDB deployment follows the recommended settings outlined in the Production Notes to ensure that MongoDB runs with the optimal settings.

Best regards,
Kevin

Avinash Bhamare

unread,
Dec 11, 2017, 1:47:01 AM12/11/17
to mongodb-user
@Kevin:
I am facing the same issue.
Config:
App: node.js v8
mongoDB: 3.4.4
mongo driver : 2.2.31
Both app and mongo are on localhost.

The code works fine while inserting <10,000 documents. It fails with error : " AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17089" when trying to insert >10,000 documents.
Interestingly it gives this error with different port numbers in the end:
 AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17089
 AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17088
 AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17091
 AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17086
 AssertionException handling request, closing client connection: 6 socket exception [SEND_ERROR] for 127.0.0.1:17087

Any idea what is going on here?

Thanks,
Avinash.

Abhishek Verma

unread,
Dec 17, 2017, 6:19:54 PM12/17/17
to mongodb-user
Hi Avinash,

Did you fix the problem? I am facing same issues.

Kevin Adistambha

unread,
Dec 20, 2017, 4:31:02 PM12/20/17
to mongodb-user

Hi Avinash, Abishek

Interestingly it gives this error with different port numbers in the end

I believe it’s the source port of the connection. See TCP/IP Port for a brief description.

The error you described could be caused by many things, such as network issues, the application trying to open too many connections to the server, or misconfigured server.

Please open a new thread, and post a short & simple version of your source code that can reproduce the error you’re seeing, along with your MongoDB version, your driver version, your deployment details (topology, hardware spec, etc.), any extra mongod parameters and config files, and what you have tried so far.

Best regards
Kevin

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages