Skip to content

memory, config: reject connections when memory usage is high (#1120)#1136

Merged
djshow832 merged 4 commits intopingcap:release-1.3from
ti-chi-bot:cherry-pick-1120-to-release-1.3
Apr 22, 2026
Merged

memory, config: reject connections when memory usage is high (#1120)#1136
djshow832 merged 4 commits intopingcap:release-1.3from
ti-chi-bot:cherry-pick-1120-to-release-1.3

Conversation

@ti-chi-bot
Copy link
Copy Markdown
Member

This is an automated cherry-pick of #1120

What problem does this PR solve?

Issue Number: close #1119

Problem Summary:
TiProxy may OOM when the connection count is too large

What is changed and how it works:

  • Reject new connections when memory usage is too high
  • Report unhealthy on the status port when the memory usage is too high

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

The memory usage and connection count increased to a fixed value:
image

The server shows connections are rejected:
image

The client failed to connect anymore:
image
After restarting the client, the client can connect again

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

- Reject connections and report unhealthy when the memory usage is too high

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Copy Markdown
Member Author

@djshow832 This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot ti-chi-bot Bot added size/XXL and removed size/XL labels Apr 21, 2026
@djshow832 djshow832 marked this pull request as draft April 21, 2026 08:32
@ti-chi-bot ti-chi-bot Bot added size/XL and removed size/XXL labels Apr 22, 2026
@djshow832 djshow832 marked this pull request as ready for review April 22, 2026 12:10
@ti-chi-bot ti-chi-bot Bot requested a review from YangKeao April 22, 2026 12:10
@djshow832
Copy link
Copy Markdown
Collaborator

/unhold

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 22, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djshow832

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 22, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-22 12:10:34.628716201 +0000 UTC m=+2167839.834076258: ☑️ agreed by djshow832.

@ti-chi-bot ti-chi-bot Bot added the approved label Apr 22, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.71233% with 34 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-1.3@ed859d5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/manager/memory/memory.go 67.77% 19 Missing and 10 partials ⚠️
pkg/proxy/net/packetio.go 0.00% 2 Missing and 1 partial ⚠️
pkg/proxy/proxy.go 95.45% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             release-1.3    #1136   +/-   ##
==============================================
  Coverage               ?   65.61%           
==============================================
  Files                  ?      124           
  Lines                  ?    12165           
  Branches               ?        0           
==============================================
  Hits                   ?     7982           
  Misses                 ?     3641           
  Partials               ?      542           
Flag Coverage Δ
unit 65.61% <76.71%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@djshow832 djshow832 merged commit 7d44ddb into pingcap:release-1.3 Apr 22, 2026
6 checks passed
@djshow832 djshow832 deleted the cherry-pick-1120-to-release-1.3 branch April 22, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants