Skip to content

Commit a32d445

Browse files
authored
DRIVERS-2223 Fix race condition in pool-checkout-returned-connection-maxConnecting.yml (#1717)
1 parent 3a4e2da commit a32d445

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,8 @@ to close and remove from its pool a [Connection](#connection) which has unread e
13741374

13751375
## Changelog
13761376

1377+
- 2024-11-01: Fixed race condition in pool-checkout-returned-connection-maxConnecting.yml test.
1378+
13771379
- 2024-01-23: Migrated from reStructuredText to Markdown.
13781380

13791381
- 2019-06-06: Add "connectionError" as a valid reason for ConnectionCheckOutFailedEvent

source/connection-monitoring-and-pooling/tests/cmap-format/pool-checkout-returned-connection-maxConnecting.json

Lines changed: 3 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/connection-monitoring-and-pooling/tests/cmap-format/pool-checkout-returned-connection-maxConnecting.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ failPoint:
1515
blockConnection: true
1616
blockTimeMS: 750
1717
poolOptions:
18+
maxConnecting: 2
1819
maxPoolSize: 10
1920
waitQueueTimeoutMS: 5000
2021
operations:
@@ -45,14 +46,13 @@ operations:
4546
count: 4
4647
- name: wait
4748
ms: 100
48-
# check original connection back in, so the thread that isn't
49-
# currently establishing will become unblocked. Then wait for
50-
# all threads to complete.
49+
# Check original connection back in, so one of the waiting threads can check
50+
# out the idle connection before the two new connections are ready.
5151
- name: checkIn
5252
connection: conn0
53-
- name: waitForEvent
54-
event: ConnectionCheckedOut
55-
count: 4
53+
# Wait for 100ms to let one of the blocked checkOut operations complete.
54+
- name: wait
55+
ms: 100
5656
events:
5757
# main thread checking out a Connection and holding it
5858
- type: ConnectionCreated
@@ -69,15 +69,13 @@ events:
6969
- type: ConnectionCheckedIn
7070
connectionId: 1
7171
address: 42
72-
# remaining thread checking out the returned Connection
72+
# Another thread checks out the returned Connection before the two new
73+
# connections are checked out.
7374
- type: ConnectionCheckedOut
7475
connectionId: 1
7576
address: 42
76-
# first two threads finishing Connection establishment
77-
- type: ConnectionCheckedOut
78-
address: 42
79-
- type: ConnectionCheckedOut
80-
address: 42
77+
# Events after this can come in different orders but still be valid.
78+
# See DRIVERS-2223 for details.
8179
ignore:
8280
- ConnectionPoolReady
8381
- ConnectionClosed

0 commit comments

Comments
 (0)