Skip to content

Conversation

@lhotari
Copy link
Member

@lhotari lhotari commented Mar 1, 2022

Motivation

Modifications

  • shutdown the ExecutorService when MLTransactionMetadataStore.closeAsync is called
    • Use Guava's MoreExecutors.shutdownAndAwaitTermination to handle ExecutorService shutdown since it handles shutdown in a proper way gracefully although in this case it seems that it would be fine to terminate forcefully by calling shutdownNow

@lhotari
Copy link
Member Author

lhotari commented Mar 1, 2022

@lordcheng10 Could this help in reducing memory consumption of branch-2.10 (v2.10.0-candidate-2) & master branch version?

@lhotari lhotari marked this pull request as draft March 2, 2022 06:30
lhotari added 2 commits March 2, 2022 08:33
- MLTransactionMetadataStore.internalPinnedExecutor wasn't closed
  when MLTransactionMetadataStore.closeAsync was called
  - problem was introduced by apache#14238 changes

- this issue causes tests to fail with OOME. Most likely this also impacts
  production code.
@lhotari lhotari force-pushed the lh-fix-OOME-in-tests branch from 5821821 to ceb3ff1 Compare March 2, 2022 09:18
@lhotari lhotari marked this pull request as ready for review March 2, 2022 09:18
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

I left one suggestion PTAL

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari
Copy link
Member Author

lhotari commented Mar 2, 2022

btw. The thread leak is visible also in test output. #10195 added https://github.com/apache/pulsar/blob/master/buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java which logs threads that are active when the test ends. For example, when running

mvn -DredirectTestOutputToFile=false -DtestRetryCount=0 test -Pcore-modules -pl pulsar-broker -DexcludedGroups='' -Dtest=ReplicatorTest#testDoNotReplicateSystemTopic

this can be seen in the console:

[INFO] [stdout] 2022-03-02T13:37:21,120+0200 [main] WARN  org.apache.pulsar.tests.ThreadLeakDetectorListener - Tests in class ReplicatorTest created thread id 1407 with name 'Thread[transaction_coordinator_TransactionCoordinatorID(id=0)thread_factory-468-1,5,main]'
[INFO] [stdout] 2022-03-02T13:37:21,120+0200 [main] WARN  org.apache.pulsar.tests.ThreadLeakDetectorListener - Tests in class ReplicatorTest created thread id 1406 with name 'Thread[transaction_coordinator_TransactionCoordinatorID(id=1)thread_factory-467-1,5,main]'

@lhotari
Copy link
Member Author

lhotari commented Mar 2, 2022

@codelipenghui Is the thread leak a blocker for 2.10 release?

@lhotari lhotari added the release/blocker Indicate the PR or issue that should block the release until it gets resolved label Mar 2, 2022
@lhotari lhotari modified the milestones: 2.11.0, 2.10.0 Mar 2, 2022
@codelipenghui
Copy link
Contributor

@lhotari Yes, this should be a blocker for 2.10.0 release, will cherry-pick this PR and start a new VOTE for 2.10.0

@lhotari lhotari merged commit 0ddec86 into apache:master Mar 2, 2022
@lhotari lhotari deleted the lh-fix-OOME-in-tests branch March 2, 2022 12:21
codelipenghui pushed a commit that referenced this pull request Mar 2, 2022
- MLTransactionMetadataStore.internalPinnedExecutor wasn't closed
  when MLTransactionMetadataStore.closeAsync was called
  - problem was introduced by #14238 changes

- this issue causes tests to fail with OOME. Most likely this also impacts
  production code.

* Close TransactionMetadataStoreService after the broker service has been closed

(cherry picked from commit 0ddec86)
gaoran10 pushed a commit that referenced this pull request Mar 11, 2022
- MLTransactionMetadataStore.internalPinnedExecutor wasn't closed
  when MLTransactionMetadataStore.closeAsync was called
  - problem was introduced by #14238 changes

- this issue causes tests to fail with OOME. Most likely this also impacts
  production code.

* Close TransactionMetadataStoreService after the broker service has been closed

(cherry picked from commit 0ddec86)
@gaoran10 gaoran10 added cherry-picked/branch-2.9 Archived: 2.9 is end of life area/broker labels Mar 11, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
- MLTransactionMetadataStore.internalPinnedExecutor wasn't closed
  when MLTransactionMetadataStore.closeAsync was called
  - problem was introduced by apache#14238 changes

- this issue causes tests to fail with OOME. Most likely this also impacts
  production code.

* Close TransactionMetadataStoreService after the broker service has been closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/blocker Indicate the PR or issue that should block the release until it gets resolved release/2.9.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants