[
https://issues.apache.org/jira/browse/FLINK-35376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867143#comment-17867143
]
中国无锡周良 commented on FLINK-35376:
--------------------------------
Will this differ from Flink's different deployment models? In other modes, when
a job is submitted, it is executed in a separate JVM, and this JVM is closed
once the job submission is complete.
Actually, as I understand it, the `{*}{{tempFile.deleteOnExit()`}}{*} method in
*{{`java.io.File`}}* indeed registers a callback to delete the temporary files
with the JVM when creating the dependencies.
However, when canceling a job using the {*}REST API{*}, in Standalone mode, the
`{*}{{deleteOnExit`}}{*} method will not be triggered, right? The
`{*}{{{}deleteOnExit{}}}`{*} method should only be triggered when the JVM shuts
down. For example, when I test stopping the Flink cluster, at that point, the
un-deleted dependencies when canceling the job will trigger the
*{{`deleteOnExit`}}* to delete the dependencies.
I believe the root cause of the problem is that:
{code:java}
this.extractedTempLibraries =
this.jarFile == null
? Collections.emptyList()
: extractContainedLibraries(this.jarFile);
{code}
This method overwrites the first instance with the second one, resulting in
only the second instance's temporary file information being cleaned up when
`{*}program.close()`{*} is called in the method:
{code:java}
final PackagedProgram program =
context.toPackagedProgram(effectiveConfiguration);
{code}
Looking forward to clarification and your response, thank you.
> When flink submits the job by calling the rest api, the dependent jar package
> generated to the tmp is not removed
> -----------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-35376
> URL: https://issues.apache.org/jira/browse/FLINK-35376
> Project: Flink
> Issue Type: Bug
> Components: Runtime / REST
> Affects Versions: 1.14.4
> Reporter: 中国无锡周良
> Priority: Major
>
> When org. Apache. Flink. Runtime. Webmonitor. Handlers. JarRunHandler#
> handleRequest receives job submission request,
> {code:java}
> final JarHandlerContext context = JarHandlerContext.fromRequest(request,
> jarDir, log);
> context.applyToConfiguration(effectiveConfiguration); {code}
> The toPackagedProgram(configuration) method generates a dependency jar to the
> tmp directory;
> Then,
> final PackagedProgram program =
> context.toPackagedProgram(effectiveConfiguration);
> Will generate a dependent jars, and org. Apache. The flink. Client. The
> program. The PackagedProgram# PackagedProgram method inside
> {code:java}
> this.extractedTempLibraries =
> this.jarFile == null
> ? Collections.emptyList()
> : extractContainedLibraries(this.jarFile); {code}
> Will be overwritten by the second generation;
>
> As a result, the dependent jar package generated for the first time cannot be
> deleted when close. If the job status detection is done and the rest api is
> automatically invoked to pull up, the jar file will always be generated in
> tmp.
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)