[ 
https://issues.apache.org/jira/browse/FLINK-6130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15970598#comment-15970598
 ] 

mingleizhang commented on FLINK-6130:
-------------------------------------

[~tedyu] Yep. And the code like below, how do you think of this ? Thanks.

{code}
        @Override
        protected int runApplicationMaster(Configuration config) {
             Future<?> future; 

        synchronized (lock) {
                LOG.info("Starting High Availability Services");
                ....
               // wait for resource manager to finish
                future = (Future<?>) resourceManager.getTerminationFuture();

                // ---- (5) start the web monitor
                // TODO: add web monitor
        }
        Object object = future.value().get();

        // everything started, we can wait until all is done or the process is 
killed
        LOG.info("YARN Application Master finished" + object.toString());
{code}

> Consider calling resourceManager#getTerminationFuture() with lock held
> ----------------------------------------------------------------------
>
>                 Key: FLINK-6130
>                 URL: https://issues.apache.org/jira/browse/FLINK-6130
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: mingleizhang
>            Priority: Minor
>
> In YarnFlinkApplicationMasterRunner#runApplicationMaster() :
> {code}
>       synchronized (lock) {
>         LOG.info("Starting High Availability Services");
> ...
>       }
>       // wait for resource manager to finish
>       resourceManager.getTerminationFuture().get();
> {code}
> resourceManager#getTerminationFuture() is called without holding lock.
> We should store the value returned from 
> resourceManager#getTerminationFuture() inside the synchronized block.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to