[
https://issues.apache.org/jira/browse/FLINK-16416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17051212#comment-17051212
]
Yangze Guo commented on FLINK-16416:
------------------------------------
AFAIK, the `TaskExecutor#onStop` is not called when I run "bin/taskmanager.sh
stop".
Below is the log:
{code:java}
2020-03-04 14:54:42,111 INFO
org.apache.flink.runtime.taskexecutor.TaskManagerRunner - RECEIVED SIGNAL
15: SIGTERM. Shutting down as requested.
2020-03-04 14:54:42,112 INFO
org.apache.flink.runtime.state.TaskExecutorLocalStateStoresManager - Shutting
down TaskExecutorLocalStateStoresManager.
2020-03-04 14:54:42,113 INFO org.apache.flink.runtime.blob.TransientBlobCache
- Shutting down BLOB cache
2020-03-04 14:54:42,113 INFO org.apache.flink.runtime.blob.PermanentBlobCache
- Shutting down BLOB cache
2020-03-04 14:54:42,117 INFO
org.apache.flink.runtime.io.disk.FileChannelManagerImpl -
FileChannelManager removed spill file directory
/tmp/flink-netty-shuffle-0eef19fb-28b5-4f77-8092-3272fdad0885
2020-03-04 14:54:42,117 INFO
org.apache.flink.runtime.io.disk.FileChannelManagerImpl -
FileChannelManager removed spill file directory
/tmp/flink-io-380f30bf-feaf-4344-acc6-b5b4ecbd6eb9
2020-03-04 14:54:42,118 INFO org.apache.flink.runtime.filecache.FileCache
- removed file cache directory
/tmp/flink-dist-cache-1b7af3c5-3e3c-46cb-b505-4547927525ae
{code}
You could see the `TaskManagerRunner` get a `SIGTERM`, and then all of the
shutdown hook is invoked. I don't see any log of `TaskExecutor#onStop`.
In my case, I want to remove some files when TM shutdown. So, the shutdown hook
is what I want? Do I understand correctly?
> Shutdown the task manager gracefully in standalone mode
> -------------------------------------------------------
>
> Key: FLINK-16416
> URL: https://issues.apache.org/jira/browse/FLINK-16416
> Project: Flink
> Issue Type: Improvement
> Components: Command Line Client
> Reporter: Yangze Guo
> Priority: Major
>
> Recently, I try to add a new {{GPUManager}} to the {{TaskExecutorServices}}.
> I register the "GPUManager#close" function, in which I write some cleanup
> logic, to the {{TaskExecutorServices#shutDown}}. However, I found that the
> cleanup logic does not run as expected in standalone mode.
> After an investigation in the codebase, I found that the
> {{TaskExecutorServices#shutDown}} will be called only on a fatal error while
> we just kill the TM process in the {{flink-daemon.sh}}. However, the LOG
> shows that some services, e.g. TaskExecutorLocalStateStoresManager, did clean
> up themselves by registering {{shutdownHook}}.
> If that is the right way, then we need to register a {{shutdownHook}} for
> {{TaskExecutorServices}} as well.
> If that is not, we may find another solution to shutdown TM gracefully.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)