Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2123

Exception on error when parsing hex data with trace on

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 2.4.0
    • Back End, Diagnostics
    • None

    Description

      When trying to parse hex data with an xsd than causes an error with trace on, I get the error below. 

      org.apache.daffodil.exceptions.Abort: Invariant broken: nConsumedBytes.>(0)
      org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
      org.apache.daffodil.io.DataDumper.convertToChar(Dump.scala:489)
      org.apache.daffodil.io.DataDumper.textDump(Dump.scala:150)
      org.apache.daffodil.io.DataDumper.$anonfun$dumpHexAndTextBytes$2(Dump.scala:297)
      at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
      at org.apache.daffodil.io.DataDumper.convertToChar(Dump.scala:489)
      at org.apache.daffodil.io.DataDumper.textDump(Dump.scala:150)
      at org.apache.daffodil.io.DataDumper.$anonfun$dumpHexAndTextBytes$2(Dump.scala:297)
      at scala.runtime.java8.JFunction1$mcVJ$sp.apply(JFunction1$mcVJ$sp.java:12)
      at scala.collection.immutable.NumericRange.foreach(NumericRange.scala:71)
      at org.apache.daffodil.io.DataDumper.dumpHexAndTextBytes(Dump.scala:264)
      at org.apache.daffodil.io.DataDumper.dump(Dump.scala:129)
      at org.apache.daffodil.processors.DataLoc.dumpStream(DataLoc.scala:144)
      at org.apache.daffodil.processors.DataLoc.dump(DataLoc.scala:104)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommandBase$Info$InfoData$.printData(InteractiveDebugger.scala:1313)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommandBase$Info$InfoData$.act(InteractiveDebugger.scala:1346)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommandBase$Info$.$anonfun$act$20(InteractiveDebugger.scala:1202)
      at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
      at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
      at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommandBase$Info$.act(InteractiveDebugger.scala:1200)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommandBase$.act(InteractiveDebugger.scala:682)
      at org.apache.daffodil.debugger.InteractiveDebugger$DebugCommand.apply(InteractiveDebugger.scala:472)
      at org.apache.daffodil.debugger.InteractiveDebugger.runCommand(InteractiveDebugger.scala:433)
      at org.apache.daffodil.debugger.InteractiveDebugger.$anonfun$debugStep$4(InteractiveDebugger.scala:174)
      at scala.collection.immutable.List.foreach(List.scala:389)
      at scala.collection.generic.TraversableForwarder.foreach(TraversableForwarder.scala:35)
      at scala.collection.generic.TraversableForwarder.foreach$(TraversableForwarder.scala:35)
      at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:44)
      at org.apache.daffodil.debugger.InteractiveDebugger.$anonfun$debugStep$1(InteractiveDebugger.scala:173)
      at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
      at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
      at org.apache.daffodil.ExecutionMode$.$anonfun$usingUnrestrictedMode$1(ExecutionMode.scala:66)
      at org.apache.daffodil.debugger.InteractiveDebugger.debugStep(InteractiveDebugger.scala:153)
      at org.apache.daffodil.debugger.InteractiveDebugger.startElement(InteractiveDebugger.scala:209)
      at org.apache.daffodil.events.MultipleEventHandler.$anonfun$startElement$1(ParseEventHandler.scala:117)
      at org.apache.daffodil.events.MultipleEventHandler.$anonfun$startElement$1$adapted(ParseEventHandler.scala:117)
      at scala.collection.immutable.List.foreach(List.scala:389)
      at org.apache.daffodil.events.MultipleEventHandler.startElement(ParseEventHandler.scala:117)
      at org.apache.daffodil.events.MultipleEventHandler.startElement$(ParseEventHandler.scala:115)
      at org.apache.daffodil.processors.DataProcessor.startElement(Runtime.scala:92)
      at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:141)
      at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:76)
      at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:70)
      at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:154)
      at org.apache.daffodil.processors.DataProcessor.doParse(Runtime.scala:223)
      at org.apache.daffodil.processors.DataProcessor.$anonfun$parse$1(Runtime.scala:196)
      at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
      at org.apache.daffodil.ExecutionMode$.$anonfun$usingRuntimeMode$1(ExecutionMode.scala:65)
      at org.apache.daffodil.processors.DataProcessor.parse(Runtime.scala:188)
      at org.apache.daffodil.processors.DataProcessor.parse(Runtime.scala:184)
      at org.apache.daffodil.Main$.$anonfun$run$1(Main.scala:862)
      at org.apache.daffodil.util.Timer$.getTimeResult(Timer.scala:76)
      at org.apache.daffodil.util.Timer$.getResult(Timer.scala:35)
      at org.apache.daffodil.Main$.run(Main.scala:862)
      at org.apache.daffodil.Main$.main(Main.scala:1361)
      at org.apache.daffodil.Main.main(Main.scala)
      

      To replicate the error, the following can be done

      daffodil --trace parse -Dtransport:Protocol=6 transport:DataLength=79 -s tcp.dfdl.xsd test.dump

      If run without --trace, one gets the error below

      [warning] Schema Definition Warning: Expression result type (Decimal) should be manually cast to the expected type (UnsignedInt) with the appropriate constructor. Performing deprecated automatic conversion.
      Schema context: DataOffset Location line 136 column 16 in file:tcp.dfdl.xsd
      [error] Parse Error: Insufficient bits in data. Needed 96 bit(s).
      Schema context: Options Location line 143 column 16 in file:tcp.dfdl.xsd
      Data location was preceding byte 20
      

       Attached is the extracted form of tcp from the public PCAP schema: https://github.com/DFDLSchemas/PCAP/blob/master/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd

      Attachments

        1. test.dump
          0.0 kB
          Olabusayo Kilo
        2. tcp.dfdl.xsd
          7 kB
          Olabusayo Kilo

        Activity

          People

            okilo@tresys.com Olabusayo Kilo
            okilo@tresys.com Olabusayo Kilo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: