Skip to content

fix(conntrack): restart ordered monitoring after receive errors - #32865

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/conntrack-listener-recovery-20261117
Nov 17, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/conntrack-listener-recovery-20261117

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32851. Follow-up to merged #32854 for the fatal-receive-error availability gap identified during its review.

What this PR does / why we need it:

The ordered, single-worker conntrack listener exits on ENOBUFS or a decode error. Previously MO only logged that error and continued reporting its stale map forever. This affects diagnostic connection statistics, not SQL or stored data.

  • Retain one worker and the existing 65,536-entry queue. A fatal listener error invalidates that statistics generation, closes its socket, and retries with fresh queues/map at most once every five seconds.
  • Drain pending publications while joining the old listener. Stop retrying if socket cleanup itself fails; repeated Dial/Listen failures do not busy-loop or accumulate listeners.
  • Keep existing log names/count fields, adding scope=since_listener_start, complete=false, and a start timestamp. This resumes future observation; it does not reconstruct events lost during overflow or claim a full kernel-table snapshot.
  • Preserve optional startup and process lifetime. No SQL path, dependency, service-shutdown hook, configuration, periodic dump, or reconciliation framework changes.

Validation on Linux/Go 1.27.1, using the current socket v0.7.0 dependency:

  • Full cmd/mo-service package: normal and race both pass, 186 tests/subtests, zero skipped.
  • Eight focused lifecycle tests: 100 race repetitions each. Covers stale-generation isolation, repeated recovery, bounded failed retries, closed/nil channels, blocked publications, and cleanup failures.
  • Actual changed MO consumer/supervisor in an isolated network namespace: three race-enabled rounds each force a real kernel ENOBUFS, restart, observe 32 TCP + 32 UDP flows and their deletion, and report 0 -> 64 -> 0. Final kernel dump is empty; cleanup joins successfully.
  • Incremental molint and golangci-lint 2.14.0: pass; native-linked binary build and -h: pass.

The monitor remains process-owned. An extra immediate-shutdown hook was deliberately excluded after testing exposed the dependency's worker-registration/Close race; runtime recovery here starts only after the worker has delivered its fatal error. Initial permission/setup failure remains nonfatal and does not start background retries. Repository-wide CI and production acceptance remain separate from these local results.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify mergify Bot added the kind/bug Something isn't working label Nov 17, 2026
@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@XuPeng-SH

XuPeng-SH commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 97fca13a482f75966e70ed2e6ba6a1bd05da8ce9

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 97fca13a482f75966e70ed2e6ba6a1bd05da8ce9

Assessment: approve

The listener owner and bounded retry loop reuse existing APIs, isolate generations, and stop stale reporting while preserving optional diagnostics. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed both changed files, complete discussion and linked issue context; source remains unchanged.

  • Isolation preflight passed. Exact-file normal/race tests passed; eight lifecycle tests each passed 100 race repetitions, and three socket boundary tests passed under race.

  • Scoped vet and formatting passed. Reused successful exact-head CI build, UT, coverage and SCA evidence.

  • Discussion coverage and all 17 local command/source/exit receipts are reconciled in the diagnostic records.

Limitations:

  • Local tests used explicit-file mode; broader package coverage relies on exact-head CI.

  • The author's real-kernel ENOBUFS experiment was not independently reproduced. Counts intentionally remain incomplete since listener start.

@mergify mergify Bot added the queued label Nov 17, 2026
@mergify
mergify Bot merged commit 59bf4b8 into matrixorigin:main Nov 17, 2026
@mergify

mergify Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

✅ Merged into main as 59bf4b8 at 16:27 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 17 Nov, 16:27 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 16:27 · 59bf4b8 · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — 97fca13a Deployed Nov 17, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants