Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2554

Extracting step metrics from ProfileStep throws NPE if the step was not triggered

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4.10
    • 3.4.12, 3.5.1, 3.6.0
    • process
    • None

    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:

      step1 -> ProfileStep -> step2 -> ProfileStep -> step3 -> ProfileStep -> step4 -> ProfileStep

      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:

      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)
      ...

      [1] https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java#L157

      Attachments

        Activity

          People

            spmallette Stephen Mallette
            saikiranboga Saikiran Boga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: