You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/05/18 12:41:02 UTC

[GitHub] [hadoop-ozone] maobaolong opened a new pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

maobaolong opened a new pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938


   ## What changes were proposed in this pull request?
   
   Fix a NPE while SCM receive and handle a datanode pipeline report, PipelineStateMap will get the pipelineList from `query2OpenPipelines`, and put the `updatedPipeline` to the list, but if the list is NULL, NPE will occur. 
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-3608
   
   ## How was this patch tested?
   
   No need
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-631789119


   @linyiqun Thank you for your review, it's important to receive your +1


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-632466692


   @xiaoyuyao Sorry, i don't find your comments inline? Could you show me where is the inline comments you mean?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-633070206


   @xiaoyuyao Sorry, i saw your reply. You are right with the condition `query2OpenPipelines has been initialized in initializeQueryMap() based on the RepType/ReFactor and has never been removed from the map`, but for the logic of the method updatePipelineState itself, i think it is better to have a non-null check, and do something to fall back. Actually, i'm just doing something broken the condition you've mentioned before, so i met the NPE already.  


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-631142980


   @linyiqun Thanks for your review comments, i've add an additional empty check, PTAL.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-630156702


   Hey @linyiqun , would you like to take a look at this PR? Thank you.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-631914992


   @elek Please take a look at this PR, thank you.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] linyiqun commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
linyiqun commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-631197650


   LGTM, +1. Thanks for addressing the comment, @maobaolong .
   I didn't have the write access to merge the PR now. So please wait others for helping review and merging.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-635766162


   Sounds good to me. Thanks @maobaolong and all for the discussion. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] linyiqun commented on a change in pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
linyiqun commented on a change in pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#discussion_r427317205



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -374,7 +374,12 @@ Pipeline updatePipelineState(PipelineID pipelineID, PipelineState state)
     PipelineQuery query = new PipelineQuery(pipeline);
     if (updatedPipeline.getPipelineState() == PipelineState.OPEN) {
       // for transition to OPEN state add pipeline to query2OpenPipelines
-      query2OpenPipelines.get(query).add(updatedPipeline);
+      List<Pipeline> pipelineList = query2OpenPipelines.get(query);
+      if (pipelineList == null) {
+        pipelineList = new CopyOnWriteArrayList<>();
+        query2OpenPipelines.put(query, pipelineList);
+      }
+      pipelineList.add(updatedPipeline);

Review comment:
       Besides above change, Can you also do the empty check for another condition branch?
       } else {
         // for transition from OPEN to CLOSED state remove pipeline from
         // query2OpenPipelines
         query2OpenPipelines.get(query).remove(pipeline);   <---
       }
   There is also a chance that remove operation can throw NPE.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] maobaolong commented on a change in pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
maobaolong commented on a change in pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#discussion_r428986889



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -372,13 +372,20 @@ Pipeline updatePipelineState(PipelineID pipelineID, PipelineState state)
     Pipeline updatedPipeline = pipelineMap.compute(pipelineID,
         (id, p) -> Pipeline.newBuilder(pipeline).setState(state).build());
     PipelineQuery query = new PipelineQuery(pipeline);
+    List<Pipeline> pipelineList = query2OpenPipelines.get(query);
     if (updatedPipeline.getPipelineState() == PipelineState.OPEN) {
       // for transition to OPEN state add pipeline to query2OpenPipelines
-      query2OpenPipelines.get(query).add(updatedPipeline);
+      if (pipelineList == null) {

Review comment:
       @xiaoyuyao Yeah, you are right while we do something initialized in initializeQueryMap(), but i am working on query unknown replication query dynamically, so initializeQueryMap() just put the known replication factor into the query2OpenPipelines. Further more, i have an idea to remove initializeQueryMap, instead, using a lazy way to add and remove items from/to the query2OpenPipelines, it is only an idea, but for this PR, it makes NPE gone away.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao merged pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
xiaoyuyao merged pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao commented on a change in pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on a change in pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#discussion_r428961690



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -372,13 +372,20 @@ Pipeline updatePipelineState(PipelineID pipelineID, PipelineState state)
     Pipeline updatedPipeline = pipelineMap.compute(pipelineID,
         (id, p) -> Pipeline.newBuilder(pipeline).setState(state).build());
     PipelineQuery query = new PipelineQuery(pipeline);
+    List<Pipeline> pipelineList = query2OpenPipelines.get(query);
     if (updatedPipeline.getPipelineState() == PipelineState.OPEN) {
       // for transition to OPEN state add pipeline to query2OpenPipelines
-      query2OpenPipelines.get(query).add(updatedPipeline);
+      if (pipelineList == null) {

Review comment:
       query2OpenPipelines has been initialized in initializeQueryMap() based on the RepType/ReFactor and has never been removed from the map. Correct me if I'm wrong, the pipelineList should never be null unless different RepType/Factor are specified in the query, which is currently impossible.   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao commented on pull request #938: HDDS-3608. NPE while process a pipeline report when PipelineQuery absent in query2OpenPipelines

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#issuecomment-632776850


   > @xiaoyuyao Sorry, i don't find your comments inline? Could you show me where is the inline comments you mean?
   
   The comments is just above:
   
   query2OpenPipelines has been initialized in initializeQueryMap() based on the RepType/ReFactor and has never been removed from the map. Correct me if I'm wrong, the pipelineList should never be null unless different RepType/Factor are specified in the query, which is currently impossible.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org