You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Saikiran Boga (Jira)" <ji...@apache.org> on 2021/04/28 01:03:00 UTC

[jira] [Updated] (TINKERPOP-2554) Extracting step metrics from ProfileStep throws NPE if the step was not triggered

     [ https://issues.apache.org/jira/browse/TINKERPOP-2554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Saikiran Boga updated TINKERPOP-2554:
-------------------------------------
    Description: 
When extracting step metrics from ProfileStep, this code block below[1] assumes that step metrics is always initialized. But if a step does not invoke starts hasNext() or next() methods for any particular reason, this throws an NPE.

An example case where this could happen is if a step decides not to invoke any upstream step by halting the execution:
{noformat}
step1 -> ProfileStep -> step2 -> ProfileStep -> step3 -> ProfileStep -> step4 -> ProfileStep{noformat}
In this case if say step3/4 decides not to get starts from previous step, then the step metrics on all the preceding ProfileStep are left uninitialized.

Sample trace:
{noformat}
java.lang.NullPointerException: null
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.addTopLevelMetrics(DefaultTraversalMetrics.java:157)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.setMetrics(DefaultTraversalMetrics.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep.hasNext(ProfileSideEffectStep.java:75) 
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.hasNext(ExpandableStepIterator.java:42)
...{noformat}
[1] [https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java#L157]

  was:
When extracting step metrics from ProfileStep, this code block below[1] assumes that  step metrics is always initialized. But if a step does not invoke starts hasNext() or next() methods for any particular reason, this throws an NPE.

An example case where this could happen is if a step decides not to invoke any upstream step by halting at any other step:
{noformat}
step1 -> ProfileStep -> step2 -> ProfileStep -> step3 -> ProfileStep -> step4 -> ProfileStep{noformat}
In this case if say step3/4 decides not to get starts from previous step, then the step metrics on all the preceding ProfileStep are left uninitialized.

Sample trace:
{noformat}
java.lang.NullPointerException: null
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.addTopLevelMetrics(DefaultTraversalMetrics.java:157)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.setMetrics(DefaultTraversalMetrics.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep.hasNext(ProfileSideEffectStep.java:75) 
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.hasNext(ExpandableStepIterator.java:42)
...{noformat}
[1] https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java#L157


> Extracting step metrics from ProfileStep throws NPE if the step was not triggered
> ---------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2554
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2554
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>            Reporter: Saikiran Boga
>            Priority: Minor
>
> When extracting step metrics from ProfileStep, this code block below[1] assumes that step metrics is always initialized. But if a step does not invoke starts hasNext() or next() methods for any particular reason, this throws an NPE.
> An example case where this could happen is if a step decides not to invoke any upstream step by halting the execution:
> {noformat}
> step1 -> ProfileStep -> step2 -> ProfileStep -> step3 -> ProfileStep -> step4 -> ProfileStep{noformat}
> In this case if say step3/4 decides not to get starts from previous step, then the step metrics on all the preceding ProfileStep are left uninitialized.
> Sample trace:
> {noformat}
> java.lang.NullPointerException: null
> at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.addTopLevelMetrics(DefaultTraversalMetrics.java:157)
> at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.setMetrics(DefaultTraversalMetrics.java:143)
> at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep.hasNext(ProfileSideEffectStep.java:75) 
> at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.hasNext(ExpandableStepIterator.java:42)
> ...{noformat}
> [1] [https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java#L157]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)