Skip to content

Fix Mongo transport recovery after socket failures#43

Merged
abnegate merged 4 commits into
mainfrom
fix/transport-recovery
Jul 20, 2026
Merged

Fix Mongo transport recovery after socket failures#43
abnegate merged 4 commits into
mainfrom
fix/transport-recovery

Conversation

@abnegate

Copy link
Copy Markdown
Member

Summary

  • hard-close failed sync and coroutine transports before reconnecting so pooled sockets cannot be reused
  • retry failed or partial writes once on a freshly authenticated connection
  • clear connection-scoped session, causal-consistency, and replica-set state after transport loss
  • apply the configured timeout to connect and invalidate malformed wire responses

Validation

  • composer format
  • composer lint
  • composer check
  • composer test (43 tests, 157 assertions)
  • focused transport regressions (15 tests, 53 assertions)
  • PHP 8.0 syntax checks
  • Swoole 5.1.2 and 6.2.1 connect/close signature checks

Copilot AI review requested due to automatic review settings July 18, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@abnegate, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ec1e108b-4e79-4545-97db-e4cfd6aaf647

📥 Commits

Reviewing files that changed from the base of the PR and between f6ef5f1 and de1bd94.

📒 Files selected for processing (2)
  • src/Client.php
  • tests/ClientTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/transport-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves Mongo transport recovery after socket failures. The main changes are:

  • Hard-closes failed sync and coroutine transports before reconnecting.
  • Retries failed or partial writes once on a fresh connection.
  • Resets connection-scoped session, causal-consistency, and replica-set state after transport loss.
  • Applies the configured connect timeout.
  • Rejects malformed wire responses and adds focused regression tests.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/Client.php Updates connection recovery, send retry, state reset, timeout handling, and response validation.
tests/ClientTest.php Adds regression coverage for transport close behavior, send retries, session preservation, failed reconnects, and malformed responses.

Reviews (3): Last reviewed commit: "test: clarify transport recovery contrac..." | Re-trigger Greptile

Comment thread src/Client.php
Comment thread src/Client.php
@abnegate
abnegate merged commit 34d9ab4 into main Jul 20, 2026
5 checks passed
@abnegate
abnegate deleted the fix/transport-recovery branch July 20, 2026 09:02
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