Skip to content

Conversation

mayuehappy
Copy link
Contributor

What is the purpose of the change

fix the thread leak in RocksDBStateUploader

Brief change log

  • name the thread group in RocksDBStateDataTransfer's ExecutorService
  • add cleanUp() in RocksDBSnapshotStrategyBase
  • invoke checkpointSnapshotStrategy.cleanUp() when RocksDBKeyedStateBackend dispose
  • add test case testDisposeCleanUpRocksDBStateDataTransferThread to Detected rocksDBStateDataTransfer thread leak

Verifying this change

This change added tests and can be verified as follows:
testDisposeCleanUpRocksDBStateDataTransferThread

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes)
  • The serializers: (no )
  • The runtime per-record code paths (performance sensitive): (no )
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? ( no)
  • If yes, how is the feature documented? (not applicable

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 16, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 5d04238 (Sat Aug 28 12:19:18 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 16, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@mayuehappy mayuehappy force-pushed the rocksdbuploader_thread_leak_bugfix branch 2 times, most recently from b32b5b9 to 6c8eb37 Compare June 17, 2021 02:54
@mayuehappy
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @mayuehappy .
I noticed that CI failed after adding commits from two PRs. So I think it was a bad idea and it's better to have two separate PRs (#16168 with production changes and this one for tests). Sorry for the confusion.
Could you please drop its commit (363c912)?

I also have some minor remarks regarding the test, PTAL.

@mayuehappy mayuehappy force-pushed the rocksdbuploader_thread_leak_bugfix branch from 6c8eb37 to 84f2780 Compare June 18, 2021 09:11
@mayuehappy
Copy link
Contributor Author

@rkhachatryan Thanks again for your review .
i have drop the commit (363c912) and the new RocksDBStateUploader was passed in TestCase (although it took some minor changes).
After every use of RocksDBKeyedStateBackend that contains this RocksDBStateUploader, it will check whether RocksDBStateUploader has been closed
can you re-review it if you got free time?

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for updating your PR @mayuehappy.
I've left some comments, PTAL.

@mayuehappy mayuehappy force-pushed the rocksdbuploader_thread_leak_bugfix branch from 84f2780 to 8c57a59 Compare June 18, 2021 18:09
@mayuehappy
Copy link
Contributor Author

@rkhachatryan Thx very much for your patience, I have updated the commit, PTAL

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks a lot for updating the PR @mayuehappy !
I have a couple of more comments (sorry for nit-picking).

Comment on lines 245 to 253
RocksDBKeyedStateBackendBuilder<K> setRocksDBStateUploader(
RocksDBStateUploader rocksDBStateUploader) {
this.injectRocksDBStateUploader = rocksDBStateUploader;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also have a similar here as in setNumberOfTransferingThreads?

Comment on lines 527 to 528
lastCompletedCheckpointId)
.setRocksDBStateUploader(stateUploader);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is no need to introduce a setter in RocksIncrementalSnapshotStrategy.
stateUploader can be passed to its constructor and be a final field there (in fact, I think one of the benefits of having a builder is immutability of the object it builds).
WDYT?

@mayuehappy
Copy link
Contributor Author

Hahahaha. . i have updated again @rkhachatryan ( Perhaps this is why flink can always guarantee a relatively high code quality 👍 )

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR @mayuehappy :) LGTM.

Could you please squash the commits (and change the component label in the commit message to tests or state).

I'd then merge it once the CI passes.

@mayuehappy mayuehappy force-pushed the rocksdbuploader_thread_leak_bugfix branch from 3cd40d1 to 5d04238 Compare June 21, 2021 10:26
@mayuehappy
Copy link
Contributor Author

Thanks again , i have squashed the commits and changed the name @rkhachatryan : )

@rkhachatryan rkhachatryan merged commit 3ebb34e into apache:master Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants