[SERVER-18246] getmore on secondary in recovery mode can crash mongos Created: 28/Apr/15  Updated: 25/Jan/17  Resolved: 07/May/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.1.1
Fix Version/s: 3.0.4, 3.1.3

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: ET
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File bad.js    
Issue Links:
Depends
Duplicate
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Participants:

 Description   
Issue Status as of Jun 19, 2015

ISSUE SUMMARY
mongos instances maintain connection pools to all shards, and do not manage the lifetime of these connections correctly. This may cause mongos instances to encounter an unrecoverable error and terminate when connecting to a replica set member in the RECOVERING state.

USER IMPACT
mongos instances may terminate in some situations while a replica set member is in the RECOVERING state.

AFFECTED VERSIONS
MongoDB release of 3.0 before 3.0.4.

FIX VERSION
The fix is included in the 3.0.4 production release.

Original description

Issue:

Whenever DBClientReplicaSet objects create connections to the nodes, it attaches the pointer to itself on the new connection. This used to be fine since the lifetime of the DBClientReplicaSet connections are guaranteed to be longer than the connection objects it creates. However, this changed with SERVER-9788. The internal connections to the secondaries are now drawn from the pool and put back to the pool. So the life of the internal connection is now independent of the lifetime of the DBClientReplicaSet connection.

Attaching test script to demonstrate crash.



 Comments   
Comment by Githook User [ 29/May/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-18246 getmore on secondary in recovery mode can crash mongos

(cherry picked from commit 5fed2241cb67c358f77fd0ff20b2afbcefa55ec1)

Conflicts:
src/mongo/client/dbclient.cpp
src/mongo/db/repl/sync_source_feedback.cpp
Branch: v3.0
https://github.com/mongodb/mongo/commit/dd81a3bec958d1d78913630fd4a3523170fd23db

Comment by Frédéric Giudicelli [ 14/May/15 ]

How come this wasn't fixed in 3.0.3 ?

Comment by Githook User [ 07/May/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-18246 getmore on secondary in recovery mode can crash mongos
Branch: master
https://github.com/mongodb/mongo/commit/5fed2241cb67c358f77fd0ff20b2afbcefa55ec1

Generated at Thu Feb 08 03:47:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.