[JAVA-762] authentication problem on Replica Set Created: 16/Feb/13 Updated: 11/Sep/19 Resolved: 21/Feb/13 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | zhoumingyi | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver, replication | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
test environment: 2)ubunto linux 12.04 x64 server (test server) 3)ubunto linux 12.04 x64 server (mongo replica set server * 3) ) , {backgroud:true}) |
||
| Attachments: |
|
| Description |
|
*******NOTE start*******
attached code runs normally when access a single mongo server(NOT a replica set ) i don't know why [m_DBAccess.isAuthenticated()]returns a false and [m_DBAccess.authenticate] pop this exception. PS: code backgroud |
| Comments |
| Comment by Jeffrey Yemin [ 21/Feb/13 ] |
|
Yeah, I agree that the documentation on this is not stellar. I'll work on a fix. |
| Comment by zhoumingyi [ 21/Feb/13 ] |
|
thank you for your reply, i know how to modify my code now. |
| Comment by Jeffrey Yemin [ 19/Feb/13 ] |
|
Furthermore, it's possible that this is a race condition in your code (between the call to isAuthenticated and authenticate), which is another reason to authenticate in the same thread as creates the Mongo instance. |
| Comment by Jeffrey Yemin [ 19/Feb/13 ] |
|
All threads share the same DB instance for each unique database name. So you only have to authenticate once. It's best to do that right after you create your Mongo instance and before that instance is distributed to other threads. |
| Comment by Jeffrey Yemin [ 19/Feb/13 ] |
|
I moved this to the JAVA project since this is an issue with usage of the Java driver, not a server issue. |