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

[Bugfix](mem) Fix memory limit check may overflow #12776

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

yangzhg
Copy link
Member

@yangzhg yangzhg commented Sep 20, 2022

Proposed changes

Issue Number: close #12775

Problem summary

This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.

Checklist(Required)

  1. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  2. Has unit tests been added:
    • Yes
    • No
    • No Need
  3. Has document been added or modified:
    • Yes
    • No
    • No Need
  4. Does it need to update dependencies:
    • Yes
    • No
  5. Are there any changes that cannot be rolled back:
    • Yes (If Yes, please explain WHY)
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link
Contributor

@xinyiZzz xinyiZzz left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 20, 2022
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@xinyiZzz xinyiZzz merged commit e70c298 into apache:master Sep 20, 2022
xinyiZzz pushed a commit to xinyiZzz/incubator-doris that referenced this pull request Sep 22, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
xinyiZzz added a commit that referenced this pull request Sep 22, 2022
* [fix][memtracker] remove gc and fix print

* [fix](memory) Fix BE OOM when load -238 fail

* [fix](memtracker) Process physical mem check does not include tc/jemalloc allocator cache (#12688)

tcmalloc/jemalloc allocator cache does not participate in the mem check as part of the process physical memory.

because new/malloc will trigger mem hook when using tcmalloc/jemalloc allocator cache, but it may not actually alloc physical memory, which is not expected in mem hook fail.

in addition:

The value of tcmalloc/jemalloc allocator cache is used as a mem tracker, the parent is the process mem tracker, which is updated every 1s.
Modify the process default mem_limit to 90%. expect mem tracker to effectively limit the memory usage of the process.

* Fix memory leak by calling  in mem hook (#12708)

After the consume mem tracker exceeds the mem limit in the mem hook, the boost stacktrace will be printed. A query/load will only be printed once, and the process tracker will only be printed once per second.

After the process memory reaches the upper limit, the boost stacktrace will be printed every second. The observed phenomena are as follows:

After query/load is canceled, the memory increases instantly;
tcmalloc profile total physical memory is less than perf process memory;
The process mem tracker is smaller than the perf process memory;

* [fix](memtracker) Fix thread mem tracker try consume accuracy #12782

* [Bugfix](mem) Fix memory limit check may overflow (#12776)

This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.

Co-authored-by: Zhengguo Yang <yangzhgg@gmail.com>
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
FreeOnePlus pushed a commit to FreeOnePlus/doris that referenced this pull request Oct 8, 2022
This bug is because the result of subtracting signed and unsigned numbers may overflow if it is negative.
@yiguolei yiguolei mentioned this pull request Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/merged-1.1.3-deprecated reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] query execute may memory limit exceeded
3 participants