Skip to content

Conversation

@shuke987
Copy link
Collaborator

What problem does this PR solve?

publishExecutors is a static field, but the constructor appends new thread pools on every invocation without checking if they already exist.

The constructor is called each time a new Env instance is created, which happens periodically during Env checkpoint/journal replay (the checkpoint thread creates a new Env to replay the journal). Each call appends publish_thread_pool_num (default 128) pools to the static list, causing unbounded growth.

Heap dump analysis (branch-4.0, 12 rounds of p0 regression) confirmed:

ThreadPoolExecutor: R1: 2,506 → R12: 12,236 (+388.3%), 11/11 strictly increasing
dbExecutors backing array grew to Object[11070] (~86 Env replays × 128 pools)
Each leaked pool retains threads, locks, and condition queues

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

`publishExecutors` is a static field, but the constructor appends new
thread pools on every invocation without checking if they already exist.

The constructor is called each time a new Env instance is created, which
happens periodically during Env checkpoint/journal replay (the checkpoint
thread creates a new Env to replay the journal). Each call appends
`publish_thread_pool_num` (default 128) pools to the static list, causing
unbounded growth.

Heap dump analysis (branch-4.0, 12 rounds of p0 regression) confirmed:
- ThreadPoolExecutor: R1: 2,506 → R12: 12,236 (+388.3%), 11/11 strictly increasing
- dbExecutors backing array grew to Object[11070] (~86 Env replays × 128 pools)
- Each leaked pool retains threads, locks, and condition queues

Fix: skip pool creation if publishExecutors is already populated.
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@shuke987
Copy link
Collaborator Author

run buildall

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 12, 2026
@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.

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 50.00% (1/2) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (2/2) 🎉
Increment coverage report
Complete coverage report

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. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants