[SERVER-6117] SlaveOk Query fails with auth error even after logging in Created: 18/Jun/12 Updated: 11/Jul/16 Resolved: 09/Jul/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client, Replication |
| Affects Version/s: | 2.0.1, 2.1.1 |
| Fix Version/s: | 2.2.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Randolph Tan | Assignee: | Randolph Tan |
| Resolution: | Done | Votes: | 0 |
| Labels: | replication | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Error message from running the attached script:
|
| Comments |
| Comment by Kay Agahd [ 21/Aug/12 ] | ||||||||||||||||||||||||||||||||||
|
Thanks Randolph. I didn't see your message because I hadn't refreshed the page before posting. | ||||||||||||||||||||||||||||||||||
| Comment by Kay Agahd [ 21/Aug/12 ] | ||||||||||||||||||||||||||||||||||
|
Btw. I tested also v2.2.0-rc0 (http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.2.0-rc0.tgz) with the same results. | ||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 20/Aug/12 ] | ||||||||||||||||||||||||||||||||||
|
Hi, This looks like a Java driver bug. I have created a new ticket ( | ||||||||||||||||||||||||||||||||||
| Comment by Kay Agahd [ 20/Aug/12 ] | ||||||||||||||||||||||||||||||||||
|
Please reopen. I tested it on v2.2.0-rc1 and could reproduce the error.
Output after several runs:
| ||||||||||||||||||||||||||||||||||
| Comment by auto [ 09/Jul/12 ] | ||||||||||||||||||||||||||||||||||
|
Author: {u'date': u'2012-07-09T12:08:58-07:00', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}Message: | ||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 09/Jul/12 ] | ||||||||||||||||||||||||||||||||||
|
Caused by: The auth helper method (which the mongo shell also uses) only authenticates the internal connection to the primary and keeps a table of previously authenticated username and passwords that work. Whenever a new connection is created, it will use this table to authenticate the newly created connection. The problem is that the current implementation does not update the auth credentials when the connection already has a cached secondary, and you'll need to make it fail once to make it marked as not ok, which will make the DBClientReplicaSet create a fresh connection that would use the stored auth table. Fix: | ||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 09/Jul/12 ] | ||||||||||||||||||||||||||||||||||
|
Removed attached test code since there are some mistakes - will push the updated test to the master branch. | ||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 21/Jun/12 ] | ||||||||||||||||||||||||||||||||||
|
Test also fails on both 2.0.1 and 2.0.6. | ||||||||||||||||||||||||||||||||||
| Comment by Andy Schwerin [ 21/Jun/12 ] | ||||||||||||||||||||||||||||||||||
|
Is this a regression from 2.0? | ||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 18/Jun/12 ] | ||||||||||||||||||||||||||||||||||
|
Attached test code. Should also test in conjunction with read preference ( |