You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by tillrohrmann <gi...@git.apache.org> on 2016/08/29 14:07:42 UTC

[GitHub] flink pull request #2436: [FLINK-4528] [rpc] Marks main thread execution met...

GitHub user tillrohrmann opened a pull request:

    https://github.com/apache/flink/pull/2436

    [FLINK-4528] [rpc] Marks main thread execution methods in RpcEndpoint as protected

    The main thread execution methods should not be exposed to the outside world of the `RpcEndpoint`, because they are internal methods.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tillrohrmann/flink fixAsyncMethods

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2436.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2436
    
----
commit 780f9c4cb4b1251fa5a7899fc3dadde694953232
Author: Till Rohrmann <tr...@apache.org>
Date:   2016-08-29T13:49:59Z

    [FLINK-4528] [rpc] Marks main thread execution methods in RpcEndpoint as protected

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2436: [FLINK-4528] [rpc] Marks main thread execution methods in...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2436
  
    I think that the `RpcEndpoint` should keep the control over which components have access to its main thread and which not. Furthermore, limiting the access to protected does not prohibit other components to use the main thread execution context. The difference is simply that the `TaskExecutor` has to actively give the context to the component instead of the component taking it. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2436: [FLINK-4528] [rpc] Marks main thread execution met...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2436#discussion_r76645756
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rpc/taskexecutor/TaskExecutorToResourceManagerConnection.java ---
    @@ -93,22 +94,24 @@ public void start() {
     		registration.startRegistration();
     
     		Future<Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess>> future = registration.getFuture();
    +
    +		ExecutionContext executionContext = taskExecutor.getRpcService().getExecutionContext();
     		
     		future.onSuccess(new OnSuccess<Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess>>() {
     			@Override
     			public void onSuccess(Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess> result) {
    -				registeredResourceManager = result.f0;
     				registrationId = result.f1.getRegistrationId();
    +				registeredResourceManager = result.f0;
     			}
    -		}, taskExecutor.getMainThreadExecutionContext());
    +		}, executionContext);
    --- End diff --
    
    If we establish the contract that you first check `registeredResourceManager` before accessing `registrationId` it should be thread-safe wrt the `registeredResourceManager` and `registrationId` fields. We could do that more explicitly by returning `null` in `getRegistrationId` if `registeredResourceManager` is not set.
    
    Additionally, we would have to guard the `start` method which should be doable without extra costs since it will be started only by one thread anyway.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2436: [FLINK-4528] [rpc] Marks main thread execution met...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2436#discussion_r76643397
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rpc/taskexecutor/TaskExecutorToResourceManagerConnection.java ---
    @@ -93,22 +94,24 @@ public void start() {
     		registration.startRegistration();
     
     		Future<Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess>> future = registration.getFuture();
    +
    +		ExecutionContext executionContext = taskExecutor.getRpcService().getExecutionContext();
     		
     		future.onSuccess(new OnSuccess<Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess>>() {
     			@Override
     			public void onSuccess(Tuple2<ResourceManagerGateway, TaskExecutorRegistrationSuccess> result) {
    -				registeredResourceManager = result.f0;
     				registrationId = result.f1.getRegistrationId();
    +				registeredResourceManager = result.f0;
     			}
    -		}, taskExecutor.getMainThreadExecutionContext());
    +		}, executionContext);
    --- End diff --
    
    Do we assume that the `TaskExecutorToResourceManagerConnection` is thread safe? If not, then operations on it should be mutually exclusive with those in the `TaskExecutor`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2436: [FLINK-4528] [rpc] Marks main thread execution met...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann closed the pull request at:

    https://github.com/apache/flink/pull/2436


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2436: [FLINK-4528] [rpc] Marks main thread execution methods in...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2436
  
    After addressing the comments, I'll merge this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2436: [FLINK-4528] [rpc] Marks main thread execution methods in...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2436
  
    Yes, will do that.
    
    On Wed, Aug 31, 2016 at 1:50 PM, Stephan Ewen <no...@github.com>
    wrote:
    
    > Okay, that makes sense.
    >
    > This would need to be updated then such that the ResourceManager passes
    > its MainThreadExecutionContext.
    >
    > \u2014
    > You are receiving this because you authored the thread.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/flink/pull/2436#issuecomment-243740478>, or mute
    > the thread
    > <https://github.com/notifications/unsubscribe-auth/AFfXugFJNjWpXGbo-_WO-kkQtxJsKACgks5qlWqCgaJpZM4Jvgqw>
    > .
    >



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2436: [FLINK-4528] [rpc] Marks main thread execution methods in...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/2436
  
    I am not sure I agree with this change.
    
    There are cases when another class logically belongs to the RPC endpoint (such as a connection utility). Being able to access the RPC execution context allows one to treat both together as a "one operation at a time" unit. I think that is pretty useful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2436: [FLINK-4528] [rpc] Marks main thread execution methods in...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/2436
  
    Okay, that makes sense.
    
    This would need to be updated then such that the ResourceManager passes its MainThreadExecutionContext.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---