Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .evergreen/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if ! command -v just &>/dev/null; then
_TARGET="--target x86_64-pc-windows-msvc"
fi
_BIN_DIR=$PYMONGO_BIN_DIR
mkdir -p ${_BIN_DIR}
echo "Installing just..."
mkdir -p "$_BIN_DIR" 2>/dev/null || true
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $_TARGET --to "$_BIN_DIR" || {
Expand All @@ -59,6 +60,7 @@ fi
# Ensure uv is installed.
if ! command -v uv &>/dev/null; then
_BIN_DIR=$PYMONGO_BIN_DIR
mkdir -p ${_BIN_DIR}
echo "Installing uv..."
# On most systems we can install directly.
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh || {
Expand Down
5 changes: 5 additions & 0 deletions pymongo/asynchronous/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
_SDAMStatusMessage,
)
from pymongo.message import _convert_exception, _GetMore, _OpMsg, _Query
from pymongo.pool_shared import _get_timeout_details, format_timeout_details
from pymongo.response import PinnedResponse, Response

if TYPE_CHECKING:
Expand Down Expand Up @@ -224,6 +225,10 @@ async def run_operation(
if use_cmd:
first = docs[0]
await operation.client._process_response(first, operation.session) # type: ignore[misc, arg-type]
# Append timeout details to MaxTimeMSExpired responses.
if first.get("code") == 50:
timeout_details = _get_timeout_details(conn.opts) # type:ignore[has-type]
first["errmsg"] += format_timeout_details(timeout_details) # type:ignore[index]
_check_command_response(first, conn.max_wire_version)
except Exception as exc:
duration = datetime.now() - start
Expand Down
5 changes: 5 additions & 0 deletions pymongo/synchronous/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
_SDAMStatusMessage,
)
from pymongo.message import _convert_exception, _GetMore, _OpMsg, _Query
from pymongo.pool_shared import _get_timeout_details, format_timeout_details
from pymongo.response import PinnedResponse, Response
from pymongo.synchronous.helpers import _handle_reauth

Expand Down Expand Up @@ -224,6 +225,10 @@ def run_operation(
if use_cmd:
first = docs[0]
operation.client._process_response(first, operation.session) # type: ignore[misc, arg-type]
# Append timeout details to MaxTimeMSExpired responses.
if first.get("code") == 50:
timeout_details = _get_timeout_details(conn.opts) # type:ignore[has-type]
first["errmsg"] += format_timeout_details(timeout_details) # type:ignore[index]
_check_command_response(first, conn.max_wire_version)
except Exception as exc:
duration = datetime.now() - start
Expand Down
1 change: 0 additions & 1 deletion test/asynchronous/test_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ async def find_one():
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
print(len(pool.conns))

@flaky(reason="PYTHON-5492")
@async_client_context.require_failCommand_appName
async def test_csot_timeout_message(self):
client = await self.async_rs_or_single_client(appName="connectionTimeoutApp")
Expand Down
1 change: 0 additions & 1 deletion test/test_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ def find_one():
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
print(len(pool.conns))

@flaky(reason="PYTHON-5492")
@client_context.require_failCommand_appName
def test_csot_timeout_message(self):
client = self.rs_or_single_client(appName="connectionTimeoutApp")
Expand Down
Loading