[SERVER-4114] If a shard contacts another shard for the first time for a MapReduce, the sharding connection hook won't be set Created: 21/Oct/11  Updated: 11/Jul/16  Resolved: 14/Nov/11

Status: Closed
Project: Core Server
Component/s: MapReduce, Security, Sharding
Affects Version/s: None
Fix Version/s: 2.0.2, 2.1.0

Type: Bug Priority: Major - P3
Reporter: Kristina Chodorow (Inactive) Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-4490 map reduce crash shard server if auth... Closed
Operating System: ALL
Participants:

 Description   

...meaning it won't automatically authenticate against the other shard, making the MapReduce crash, making the mongod crash.



 Comments   
Comment by auto [ 15/Nov/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: SERVER-4114: added admin user to each shard for better testing
Branch: master
https://github.com/mongodb/mongo/commit/d9ee2526f4c46251a32ae3f347bdef80fb466cc3

Comment by auto [ 14/Nov/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: - SERVER-4114: also add auth hook to shardConnectionPool
Branch: v2.0
https://github.com/mongodb/mongo/commit/58a501e059ba633bc6e331a8114638ac6fba2ac0

Comment by Antoine Girbal [ 09/Nov/11 ]

marking backport back to yes, since another commit was made

Comment by Antoine Girbal [ 08/Nov/11 ]

I added a test, but it does not properly test the fix.
The problem is that when servers are all running localhost then auth is more permissive.
This issue does not appear if running using localhost.
When testing manually with distincts hosts, it fails before fix and works after fix.
to make proper test we would have to use distinct IPs maybe using virtual interfaces.

Comment by auto [ 08/Nov/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: SERVER-4114: added test
Branch: master
https://github.com/mongodb/mongo/commit/fe7f1c66ffa4490b24f5b314e918115afa353db5

Comment by auto [ 07/Nov/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: - SERVER-4114: also add auth hook to shardConnectionPool
Branch: master
https://github.com/mongodb/mongo/commit/4158c0c58830fc1e8b7fe5a97e771e5df0ebd61f

Comment by Antoine Girbal [ 07/Nov/11 ]

code in d_state.cpp that adds hook:

void ShardedConnectionInfo::addHook() {
static bool done = false;
if (!done)

{ LOG(1) << "adding sharding hook" << endl; pool.addHook(new ShardingConnectionHook(false)); done = true; }

}

It seems that there is 2nd pool shardConnectionPool that comes in from s/ code.
if I add this line to code then MR is fixed:
shardConnectionPool.addHook(new ShardingConnectionHook(false));

lmk if it sounds like good fix

Comment by Antoine Girbal [ 07/Nov/11 ]

the fix is not working.
it seems there are 2 connection pools being used, and hook gets installed on the wrong one.

Comment by auto [ 25/Oct/11 ]

Author:

{u'login': u'kchodorow', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: Set auth hook in final MR step, if it wasn't set previously SERVER-4114
Branch: v2.0
https://github.com/mongodb/mongo/commit/de05cdff5373ff6d179e16320b39ff41ee55f185

Comment by auto [ 24/Oct/11 ]

Author:

{u'login': u'kchodorow', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: Set auth hook in final MR step, if it wasn't set previously SERVER-4114
Branch: master
https://github.com/mongodb/mongo/commit/5e0672d6deee862820c103b908f1c8844e4b0c66

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