Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdc/sorter: make unified sorter cgroup aware (#3436) #3438

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #3436

What problem does this PR solve?

It fixes an OOM issue where memory limited by cgroup is smaller
than physical memory.

Note this patch only recognizes container cgroup, it may still
OOM when the cgroup is set by systemd or manually.

Cc https://github.com/pingcap/ticdc/issues/1798

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. mysql -h TIDBIP -P 4000 -u root -E -e 'update mysql.tidb set VARIABLE_VALUE="2400h" where VARIABLE_NAME="tikv_gc_life_time";'
  2. tiup bench tpcc --host TIDBIP --port 4000 prepare -T 10 --warehouses 100
  3. tiup bench tpcc --host TIDBIP --port 4000 run -T 10 --warehouses 100
  4. run cdc in 8G memory docker container.
  5. ./cdc cli --pd="http://PDIP" changefeed create
    --sink-uri="mysql://xx:xx@MYSQLIP:3306/" -c "mysql37"
    --start-ts=$(( $(pd-ctl -u http://PDIP service-gc-safepoint | jq '.service_gc_safe_points[] | select(.service_id == "gc_worker") | .safe_point') + 1000 ))
    --no-confirm --sort-engine=unified
OOM log in demsg
[Fri Nov 12 17:23:50 2021] CPU: 6 PID: 2542 Comm: cdc Kdump: loaded Tainted: G               ------------ T 3.10.0-1127.13.1.el7.x86_64 #1
[Fri Nov 12 17:23:50 2021] Hardware name: Dell Inc. PowerEdge R630/02C2CP, BIOS 2.4.3 01/17/2017
[Fri Nov 12 17:23:50 2021] Call Trace:
[Fri Nov 12 17:23:50 2021]  [<ffffffffa197ffa5>] dump_stack+0x19/0x1b
[Fri Nov 12 17:23:50 2021]  [<ffffffffa197a8c3>] dump_header+0x90/0x229
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1327aa4>] ? __css_tryget+0x24/0x50
[Fri Nov 12 17:23:50 2021]  [<ffffffffa13c24ce>] oom_kill_process+0x25e/0x3f0
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1333a01>] ? cpuset_mems_allowed_intersects+0x21/0x30
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1440c06>] mem_cgroup_oom_synchronize+0x546/0x570
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1440080>] ? mem_cgroup_charge_common+0xc0/0xc0
[Fri Nov 12 17:23:50 2021]  [<ffffffffa13c2d74>] pagefault_out_of_memory+0x14/0x90
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1978dd3>] mm_fault_error+0x6a/0x157
[Fri Nov 12 17:23:50 2021]  [<ffffffffa198d8d1>] __do_page_fault+0x491/0x500
[Fri Nov 12 17:23:50 2021]  [<ffffffffa198d975>] do_page_fault+0x35/0x90
[Fri Nov 12 17:23:50 2021]  [<ffffffffa1989778>] page_fault+0x28/0x30
[Fri Nov 12 17:23:50 2021] Task in /docker/2b34db4f57b5dff0b20a52ecbbdf1113450a5d19d86a68243bdd7814d4b743a6 killed as a result of limit of /docker/2b34db4f57b5dff0b20a52ecbbdf1113450a5d19d86a68243bdd7814d4b743a6
[Fri Nov 12 17:23:50 2021] memory: usage 8388608kB, limit 8388608kB, failcnt 41731
[Fri Nov 12 17:23:50 2021] memory+swap: usage 8388608kB, limit 16777216kB, failcnt 0
[Fri Nov 12 17:23:50 2021] kmem: usage 9100kB, limit 9007199254740988kB, failcnt 0
[Fri Nov 12 17:23:50 2021] Memory cgroup stats for /docker/2b34db4f57b5dff0b20a52ecbbdf1113450a5d19d86a68243bdd7814d4b743a6: cache:688KB rss:8378820KB rss_huge:0KB mapped_file:28KB swap:0KB inactive_anon:0KB active_anon:8378772KB inactive_file:152KB active_file:32KB unevictable:0KB
[Fri Nov 12 17:23:50 2021] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
[Fri Nov 12 17:23:50 2021] [33150]     0 33150      409       34       5        0             0 sh
[Fri Nov 12 17:23:50 2021] [35361]     0 35361      409       48       5        0             0 sh
[Fri Nov 12 17:23:50 2021] [36043]     0 36043      365       48       4        0             0 less
[Fri Nov 12 17:23:50 2021] [ 2532]     0  2532  2297379  2100625    4178        0             0 cdc
[Fri Nov 12 17:23:50 2021] Memory cgroup out of memory: Kill process 2621 (cdc) score 1003 or sacrifice child
[Fri Nov 12 17:23:50 2021] Killed process 2532 (cdc), UID 0, total-vm:9189516kB, anon-rss:8375780kB, file-rss:26720kB, shmem-rss:0kB

Left: master
Right: this PR

image

Related changes

  • Need to cherry-pick to the release branch

Release note

Fix OOM in container environments.

@ti-chi-bot
Copy link
Member Author

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 12, 2021
@ti-chi-bot ti-chi-bot added component/sorter Sorter component. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-5.2 This PR is cherry-picked to release-5.2 from a source PR. labels Nov 12, 2021
Signed-off-by: Neil Shen <[email protected]>
@nongfushanquan nongfushanquan added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Nov 15, 2021
@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member Author

This pull request has been accepted and is ready to merge.

Commit hash: 088c11c

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 15, 2021
@overvenus
Copy link
Member

/run-kafka-integration-test
/run-integration-tests

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (release-5.2@206c20c). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             release-5.2      #3438   +/-   ##
================================================
  Coverage               ?   53.9122%           
================================================
  Files                  ?        192           
  Lines                  ?      21535           
  Branches               ?          0           
================================================
  Hits                   ?      11610           
  Misses                 ?       8827           
  Partials               ?       1098           

@ti-chi-bot ti-chi-bot merged commit 9afef7b into pingcap:release-5.2 Nov 16, 2021
@overvenus overvenus added this to the v5.2.4 milestone Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/sorter Sorter component. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-5.2 This PR is cherry-picked to release-5.2 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants