Skip to content

Conversation

blink1073
Copy link
Member

No description provided.

@ShaneHarvey
Copy link
Member

ShaneHarvey commented Aug 23, 2024

In one case this test appears to be failing due to a bug:

 [2024/08/22 08:03:32.279] FAILURE: AssertionError: TimeoutError() is not an instance of <class 'pymongo.errors.NetworkTimeout'> () [2024/08/22 08:03:32.279] self = <test.asynchronous.test_client_bulk_write.TestClientBulkWriteCSOT testMethod=test_timeout_in_multi_batch_bulk_write> [2024/08/22 08:03:32.279] @async_client_context.require_version_min(8, 0, 0, -24) [2024/08/22 08:03:32.279] @async_client_context.require_failCommand_fail_point [2024/08/22 08:03:32.279] async def test_timeout_in_multi_batch_bulk_write(self): [2024/08/22 08:03:32.279] _OVERHEAD = 500 [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] internal_client = await async_rs_or_single_client(timeoutMS=None) [2024/08/22 08:03:32.279] self.addAsyncCleanup(internal_client.close) [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] collection = internal_client.db["coll"] [2024/08/22 08:03:32.279] self.addAsyncCleanup(collection.drop) [2024/08/22 08:03:32.279] await collection.drop() [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] fail_command = { [2024/08/22 08:03:32.279] "configureFailPoint": "failCommand", [2024/08/22 08:03:32.279] "mode": {"times": 2}, [2024/08/22 08:03:32.279] "data": {"failCommands": ["bulkWrite"], "blockConnection": True, "blockTimeMS": 1010}, [2024/08/22 08:03:32.279] } [2024/08/22 08:03:32.279] async with self.fail_point(fail_command): [2024/08/22 08:03:32.279] models = [] [2024/08/22 08:03:32.279] num_models = int(self.max_message_size_bytes / self.max_bson_object_size + 1) [2024/08/22 08:03:32.279] b_repeated = "b" * (self.max_bson_object_size - _OVERHEAD) [2024/08/22 08:03:32.279] for _ in range(num_models): [2024/08/22 08:03:32.279] models.append( [2024/08/22 08:03:32.279] InsertOne( [2024/08/22 08:03:32.279] namespace="db.coll", [2024/08/22 08:03:32.279] document={"a": b_repeated}, [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] listener = OvertCommandListener() [2024/08/22 08:03:32.279] client = await async_rs_or_single_client( [2024/08/22 08:03:32.279] event_listeners=[listener], [2024/08/22 08:03:32.279] readConcernLevel="majority", [2024/08/22 08:03:32.279] readPreference="primary", [2024/08/22 08:03:32.279] timeoutMS=2000, [2024/08/22 08:03:32.279] w="majority", [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] self.addAsyncCleanup(client.close) [2024/08/22 08:03:32.279] await client.admin.command("ping") # Init the client first. [2024/08/22 08:03:32.279] with self.assertRaises(ClientBulkWriteException) as context: [2024/08/22 08:03:32.279] await client.bulk_write(models=models) [2024/08/22 08:03:32.279] > self.assertIsInstance(context.exception.error, NetworkTimeout) [2024/08/22 08:03:32.279] E AssertionError: TimeoutError() is not an instance of <class 'pymongo.errors.NetworkTimeout'> [2024/08/22 08:03:32.279] test\asynchronous\test_client_bulk_write.py:599: AssertionError 

PyMongo shouldn't be raising a TimeoutError.

Jibola
Jibola previously approved these changes Aug 23, 2024
Copy link
Contributor

@Jibola Jibola left a comment

Choose a reason for hiding this comment

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

LGTM

@Jibola Jibola self-requested a review August 23, 2024 19:09
@Jibola Jibola dismissed their stale review August 23, 2024 19:10

Saw above comment

@Jibola
Copy link
Contributor

Jibola commented Aug 23, 2024

In one case this test appears to be failing due to a bug:

 [2024/08/22 08:03:32.279] FAILURE: AssertionError: TimeoutError() is not an instance of <class 'pymongo.errors.NetworkTimeout'> () [2024/08/22 08:03:32.279] self = <test.asynchronous.test_client_bulk_write.TestClientBulkWriteCSOT testMethod=test_timeout_in_multi_batch_bulk_write> [2024/08/22 08:03:32.279] @async_client_context.require_version_min(8, 0, 0, -24) [2024/08/22 08:03:32.279] @async_client_context.require_failCommand_fail_point [2024/08/22 08:03:32.279] async def test_timeout_in_multi_batch_bulk_write(self): [2024/08/22 08:03:32.279] _OVERHEAD = 500 [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] internal_client = await async_rs_or_single_client(timeoutMS=None) [2024/08/22 08:03:32.279] self.addAsyncCleanup(internal_client.close) [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] collection = internal_client.db["coll"] [2024/08/22 08:03:32.279] self.addAsyncCleanup(collection.drop) [2024/08/22 08:03:32.279] await collection.drop() [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] fail_command = { [2024/08/22 08:03:32.279] "configureFailPoint": "failCommand", [2024/08/22 08:03:32.279] "mode": {"times": 2}, [2024/08/22 08:03:32.279] "data": {"failCommands": ["bulkWrite"], "blockConnection": True, "blockTimeMS": 1010}, [2024/08/22 08:03:32.279] } [2024/08/22 08:03:32.279] async with self.fail_point(fail_command): [2024/08/22 08:03:32.279] models = [] [2024/08/22 08:03:32.279] num_models = int(self.max_message_size_bytes / self.max_bson_object_size + 1) [2024/08/22 08:03:32.279] b_repeated = "b" * (self.max_bson_object_size - _OVERHEAD) [2024/08/22 08:03:32.279] for _ in range(num_models): [2024/08/22 08:03:32.279] models.append( [2024/08/22 08:03:32.279] InsertOne( [2024/08/22 08:03:32.279] namespace="db.coll", [2024/08/22 08:03:32.279] document={"a": b_repeated}, [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] [2024/08/22 08:03:32.279] listener = OvertCommandListener() [2024/08/22 08:03:32.279] client = await async_rs_or_single_client( [2024/08/22 08:03:32.279] event_listeners=[listener], [2024/08/22 08:03:32.279] readConcernLevel="majority", [2024/08/22 08:03:32.279] readPreference="primary", [2024/08/22 08:03:32.279] timeoutMS=2000, [2024/08/22 08:03:32.279] w="majority", [2024/08/22 08:03:32.279] ) [2024/08/22 08:03:32.279] self.addAsyncCleanup(client.close) [2024/08/22 08:03:32.279] await client.admin.command("ping") # Init the client first. [2024/08/22 08:03:32.279] with self.assertRaises(ClientBulkWriteException) as context: [2024/08/22 08:03:32.279] await client.bulk_write(models=models) [2024/08/22 08:03:32.279] > self.assertIsInstance(context.exception.error, NetworkTimeout) [2024/08/22 08:03:32.279] E AssertionError: TimeoutError() is not an instance of <class 'pymongo.errors.NetworkTimeout'> [2024/08/22 08:03:32.279] test\asynchronous\test_client_bulk_write.py:599: AssertionError 

PyMongo shouldn't be raising a TimeoutError.

Should this one get its own task, then?

@blink1073
Copy link
Member Author

Should this one get its own task, then?

I opened https://jira.mongodb.org/browse/PYTHON-4695

@blink1073 blink1073 requested review from ShaneHarvey and removed request for shruti-sridhar August 26, 2024 13:03
@blink1073 blink1073 merged commit f439204 into mongodb:master Aug 26, 2024
@blink1073 blink1073 deleted the PYTHON-4692 branch August 26, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants