Skip to content

Conversation

@ShaneHarvey
Copy link
Member

Fixes a noisy OperationFailure: Authentication failed error.
Do not attempt to create unneeded connections to arbiters, ghosts,
hidden members, or unknown members.

Fixes a noisy OperationFailure: Authentication failed error.
Do not attempt to create unneeded connections to arbiters, ghosts,
hidden members, or unknown members.
Copy link
Contributor

@prashantmital prashantmital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question about arbiters with auth - LGTM otherwise.

arbiter = c._topology.get_server_by_address(('d', 4))
self.assertFalse(arbiter.pool.sockets)

def test_direct_client_maintains_pool_to_arbiter(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the directConnectio=True scenario, should we have any special handling for the case where authentication is enabled on the arbiter? Based on these docs:

the only way to log on to an arbiter with authorization active is to use the localhost exception.

it seems that we will never be able to populate a pool that connects to an arbiter with auth, or am I reading that wrong? What will the user-facing behavior be in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if a user wants to connect directly to an arbiter they will need to remove auth parameters.

@ShaneHarvey
Copy link
Member Author

Sigh, this change seems to make these two tests more flakey:

 [2021/04/07 19:05:07.562] FAIL [10.033s]: test_max_idle_time_reaper (test_client.TestClient)
 [2021/04/07 19:05:07.562] ----------------------------------------------------------------------
 [2021/04/07 19:05:07.562] Traceback (most recent call last):
 [2021/04/07 19:05:07.562]   File "/data/mci/0f97b1956ba2d463825378bfe9902bfe/src/test/test_client.py", line 473, in test_max_idle_time_reaper
 [2021/04/07 19:05:07.562]     "remove stale socket")
 [2021/04/07 19:05:07.562]   File "/data/mci/0f97b1956ba2d463825378bfe9902bfe/src/test/utils.py", line 741, in wait_until
 [2021/04/07 19:05:07.562]     raise AssertionError("Didn't ever %s" % success_description)
 [2021/04/07 19:05:07.562] AssertionError: Didn't ever remove stale socket

https://evergreen.mongodb.com/task/mongo_python_driver_tests_python_version_amazon1_test_ssl__platform~awslinux_auth~noauth_ssl~nossl_python_version~3.6_coverage~coverage_test_2.6_replica_set_patch_cc029a1e6208863eaab453777363d3935b927f32_606dfefb61837d0383bb0567_21_04_07_18_50_36

And:

 [2021/04/07 19:02:56.470] FAIL [10.028s]: test_min_pool_size (test_client.TestClient)
 [2021/04/07 19:02:56.470] ----------------------------------------------------------------------
 [2021/04/07 19:02:56.470] Traceback (most recent call last):
 [2021/04/07 19:02:56.470]   File "/data/mci/4b8f11bb525edfac5c311f757eda876c/src/test/test_client.py", line 519, in test_min_pool_size
 [2021/04/07 19:02:56.470]     "pool initialized with 10 sockets")
 [2021/04/07 19:02:56.470]   File "/data/mci/4b8f11bb525edfac5c311f757eda876c/src/test/utils.py", line 741, in wait_until
 [2021/04/07 19:02:56.470]     raise AssertionError("Didn't ever %s" % success_description)
 [2021/04/07 19:02:56.470] AssertionError: Didn't ever pool initialized with 10 sockets

https://evergreen.mongodb.com/task/mongo_python_driver_tests_python_version_amazon1_test_ssl__platform~awslinux_auth~noauth_ssl~nossl_python_version~3.6_coverage~coverage_test_4.2_replica_set_patch_cc029a1e6208863eaab453777363d3935b927f32_606dfefb61837d0383bb0567_21_04_07_18_50_36

I believe this is because the background thread now has to wait for the SDAM state to be discovered before attempting to populate the pool but I am very surprised to see that this wouldn't happen within the test's 10 second timeout. Perhaps there is too much thread contention and one of the monitors is being starved for 10 seconds?

@ShaneHarvey ShaneHarvey merged commit 4c7718e into mongodb:master Apr 19, 2021
ShaneHarvey added a commit to ShaneHarvey/mongo-python-driver that referenced this pull request Apr 19, 2021
Fixes a noisy OperationFailure: Authentication failed error.
Do not attempt to create unneeded connections to arbiters, ghosts,
hidden members, or unknown members.

(cherry picked from commit 4c7718e)

 Conflicts:
	pymongo/topology.py
	test/test_client.py
	test/test_cmap.py
ShaneHarvey added a commit to ShaneHarvey/mongo-python-driver that referenced this pull request Apr 19, 2021
Fixes a noisy OperationFailure: Authentication failed error.
Do not attempt to create unneeded connections to arbiters, ghosts,
hidden members, or unknown members.

(cherry picked from commit 4c7718e)

 Conflicts:
	pymongo/topology.py
	test/test_client.py
	test/test_cmap.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants