-
Type:
Build Failure
-
Resolution: Fixed
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: greenerbuild
-
None
-
None
-
Python Drivers
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
TestSession.test_implicit_sessions_checkout is flaky on free threaded mode:
_________________ TestSession.test_implicit_sessions_checkout __________________
self = <test.test_session.TestSession testMethod=test_implicit_sessions_checkout>
def test_implicit_sessions_checkout(self):
# "To confirm that implicit sessions only allocate their server session after a
# successful connection checkout" test from Driver Sessions Spec.
succeeded = False
lsid_set = set()
failures = 0
for _ in range(5):
listener = OvertCommandListener()
client = self.rs_or_single_client(event_listeners=[listener], maxPoolSize=1)
cursor = client.db.test.find({})
ops: List[Tuple[Callable, List[Any]]] = [
(client.db.test.find_one, [{"_id": 1}]),
(client.db.test.delete_one, [{}]),
(client.db.test.update_one, [{}, {"$set": {"x": 2}}]),
(client.db.test.bulk_write, [[UpdateOne({}, {"$set": {"x": 2}})]]),
(client.db.test.find_one_and_delete, [{}]),
(client.db.test.find_one_and_update, [{}, {"$set": {"x": 1}}]),
(client.db.test.find_one_and_replace, [{}, {}]),
(client.db.test.aggregate, [[{"$limit": 1}]]),
(client.db.test.find, []),
(client.server_info, []),
(client.db.aggregate, [[{"$listLocalSessions": {}}, {"$limit": 1}]]),
(cursor.distinct, ["_id"]),
(client.db.list_collections, []),
]
tasks = []
listener.reset()
def target(op, *args):
if iscoroutinefunction(op):
res = op(*args)
else:
res = op(*args)
if isinstance(res, (Cursor, CommandCursor)):
res.to_list()
for op, args in ops:
tasks.append(
ExceptionCatchingTask(target=target, args=[op, *args], name=op.__name__)
)
tasks[-1].start()
self.assertEqual(len(tasks), len(ops))
for t in tasks:
t.join()
self.assertIsNone(t.exc)
client.close()
lsid_set.clear()
for i in listener.started_events:
if i.command.get("lsid"):
lsid_set.add(i.command.get("lsid")["id"])
if len(lsid_set) == 1:
succeeded = True
else:
failures += 1
> self.assertTrue(succeeded, lsid_set)
E AssertionError: False is not true : {Binary(b'C[\xf3\x04~\x8cD\xfa\x99|m\x06\xf9\xf9W\x02', 4), Binary(b'\xc1"\xd4\xda\xfd\xc1G\xca\x8dnvQ\xad\xea\xc6\xef', 4)}
https://github.com/mongodb/mongo-python-driver/actions/runs/15538640195/job/43743745364?pr=2363