You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by StephenJeson <gi...@git.apache.org> on 2018/04/23 04:01:21 UTC

[GitHub] flink pull request #5894: [FLINK-9185] [runtime] Fix potential null derefere...

GitHub user StephenJeson opened a pull request:

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

    [FLINK-9185] [runtime] Fix potential null dereference in PrioritizedO…

    ## What is the purpose of the change
    
    Fix potential null dereference in PrioritizedOperatorSubtaskState#resolvePrioritizedAlternatives
    
    
    ## Brief change log
    
      - Add null check for the return value of  approve function in PrioritizedOperatorSubtaskState#resolvePrioritizedAlternatives
    
    
    ## Verifying this change
    
    This change is a trivial rework / code cleanup without any test coverage.
    
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (no)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
      - The serializers: (no)
      - The runtime per-record code paths (performance sensitive): (no)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
      - The S3 file system connector: (no)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (no)
      - If yes, how is the feature documented? (not documented)


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

    $ git pull https://github.com/StephenJeson/flink flink-9185

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

    https://github.com/apache/flink/pull/5894.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 #5894
    
----
commit 80a9cf185dc33fe0182563e945635bc5ea971453
Author: Stephen Jason <st...@...>
Date:   2018-04-21T11:19:26Z

    [FLINK-9185] [runtime] Fix potential null dereference in PrioritizedOperatorSubtaskState#resolvePrioritizedAlternatives

----


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    @tedyu Are you available to review  my code?


---

[GitHub] flink pull request #5894: [FLINK-9185] [runtime] Fix potential null derefere...

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

    https://github.com/apache/flink/pull/5894#discussion_r203378828
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PrioritizedOperatorSubtaskState.java ---
    @@ -281,10 +281,15 @@ public PrioritizedOperatorSubtaskState build() {
     				// approve-function signaled true.
     				if (alternative != null
     					&& alternative.hasState()
    -					&& alternative.size() == 1
    -					&& approveFun.apply(reference, alternative.iterator().next())) {
    --- End diff --
    
    Many thanks for your suggestion, I'll try to refine it.


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    lgtm
    
    Please check test failure.


---

[GitHub] flink pull request #5894: [FLINK-9185] [runtime] Fix potential null derefere...

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

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


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    Thanks for you contribution @StephenJeson ! Looks good to me from my side.


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    Hey @tillrohrmann, Could you please take a look on this? It is my first contribution to Flink project.


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    @tedyu All tests passed after rebasing the latest code.


---

[GitHub] flink issue #5894: [FLINK-9185] [runtime] Fix potential null dereference in ...

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

    https://github.com/apache/flink/pull/5894
  
    @tillrohrmann I have finished the code, could you please help me to review this at your convenience.


---

[GitHub] flink pull request #5894: [FLINK-9185] [runtime] Fix potential null derefere...

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

    https://github.com/apache/flink/pull/5894#discussion_r203368063
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PrioritizedOperatorSubtaskState.java ---
    @@ -281,10 +281,15 @@ public PrioritizedOperatorSubtaskState build() {
     				// approve-function signaled true.
     				if (alternative != null
     					&& alternative.hasState()
    -					&& alternative.size() == 1
    -					&& approveFun.apply(reference, alternative.iterator().next())) {
    --- End diff --
    
    Could we wrap this application in `BooleanUtils.isTrue(approveFun.apply(reference, alternative.iterator().next()))` in order to avoid the extra conditions?


---