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

Get Incorrect limit_in_bytes and usage_in_bytes #22132

Closed
mahjonp opened this issue Dec 31, 2020 · 1 comment
Closed

Get Incorrect limit_in_bytes and usage_in_bytes #22132

mahjonp opened this issue Dec 31, 2020 · 1 comment
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@mahjonp
Copy link
Contributor

mahjonp commented Dec 31, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

TiDB parses "/sys/fs/cgroup/memory/memory.limit_in_bytes" to get memory limit value and "/sys/fs/cgroup/memory/memory.usage_in_bytes" to retrieve usage currently, it's not correct in some situations.

1. Minimal reproduce step (Required)

For example, I deploy a tidb cluster through TiUP like following steps:

  1. Edit topology.yaml
global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/data1/tidb/deploy"
  data_dir: "/data1/tidb/deploy/data"
  resource_control:
    memory_limit: "4G"
    cpu_quota: "200%"

tidb_servers:
  - host: 172.16.5.86

tikv_servers:
  - host: 172.16.5.86

pd_servers:
  - host: 172.16.5.86
  1. tiup cluster deploy test-tidb nightly topology.yaml
  2. tiup cluster start test-tidb

2. What did you expect to see? (Required)

TiDB-server should get memory limit and usage in /sys/fs/cgroup/memory/system.slice/tidb-4000.service/memory.limit_in_bytes and cat /sys/fs/cgroup/memory/system.slice/tidb-4000.service/memory.usage_in_bytes

3. What did you see instead (Required)

https://github.com/wshwsh12/tidb/blob/e9896cf8ae6c11e58f15fabe6802283dfd20585e/util/memory/meminfo.go#L43-L44

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-1941-gdad3b5e87
Edition: Community
Git Commit Hash: dad3b5e87d21caf29bd7f0c7d968cd410e7a5cdd
Git Branch: master
UTC Build Time: 2020-12-30 14:16:40
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@mahjonp mahjonp added the type/bug The issue is confirmed as a bug. label Dec 31, 2020
@bb7133 bb7133 added sig/execution SIG execution and removed sig/sql-infra SIG: SQL Infra labels Feb 22, 2021
@jebter jebter added affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. labels Jan 11, 2022
@hawkingrei
Copy link
Member

Now it has been fixed by #36901.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants