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

[FLINK-21164][rest] Delete temporary jars #14777

Merged
merged 5 commits into from
Jan 29, 2021
Merged

[FLINK-21164][rest] Delete temporary jars #14777

merged 5 commits into from
Jan 29, 2021

Conversation

zentol
Copy link
Contributor

@zentol zentol commented Jan 27, 2021

Modifies the Jar(Run|Plan)Handler to call PackagedProgram#deleteExtractedLibraries once we are done with the job submission / plan generation.

This is not covered by tests; I don't see a good way to do that since from the outside it is neither obvious which files are supposed to (not) exist nor where the temporary files would be located (by virtue of PackagedProgram not respecting the io.tmp.dirs option).

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 27, 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 c833d99 (Fri May 28 08:15:03 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 Jan 27, 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

Copy link
Contributor

@tillrohrmann tillrohrmann 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 creating this PR @zentol. The change itself looks good. I had a couple of comments concerning other places where the PackagedProgram is being used.

@@ -103,6 +103,11 @@ public JarRunHandler(
executor)
.handle(
(jobIds, throwable) -> {
try {
program.deleteExtractedLibraries();
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't JarListHandler also susceptible to the problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am also wondering whether the ApplicationClusterEntryPoint really cleans up a PackagedProgram after using. Maybe this is something to investigate as a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the JarListHandler has the same problem. I did not know it actually creates a PackagedProgram.

As for the ApplicationClusterEntryPoint, the files should be cleaned up when the entry point shuts down because we call File#deleteOnExit in PackagedProgram#createTempFile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now whether they are actually deleted depends a bit on when the JVM executes the delete calls. If the ClassLoader is still around at that time, then the deletion may in fact fail.

Explicitly closing the ClassLoader in the PackagedProgram (which unfortunately leaks into the JobGraph...) is a separate issue (see FLINK-9844).

Copy link
Contributor

Choose a reason for hiding this comment

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

Alrighty. Thanks for the update.

zentol and others added 4 commits January 29, 2021 14:29
…nitor/handlers/JarRunHandler.java

Co-authored-by: Till Rohrmann <till.rohrmann@gmail.com>
…nitor/handlers/JarPlanHandler.java

Co-authored-by: Till Rohrmann <till.rohrmann@gmail.com>
@zentol
Copy link
Contributor Author

zentol commented Jan 29, 2021

@tillrohrmann I updated the PR. PackagedProgram now implements AutoClosable, and all usages of PackagedProgram#deleteExtractedLibraries have been migrated to use close() instead.
In FLINK-9844 we can then extend this method to also close the ClassLoader.

I will also file a follow-up ticket to explicitly call close() in the entry points.

Copy link
Contributor

@tillrohrmann tillrohrmann 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 update @zentol. LGTM. +1 for merging.

@zentol zentol merged commit 30f6964 into apache:master Jan 29, 2021
@zentol zentol deleted the 21164 branch February 8, 2021 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants