You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2022/01/13 13:33:00 UTC

[jira] [Created] (DAFFODIL-2624) cannot use trace when doing streaming parse calls

Mike Beckerle created DAFFODIL-2624:
---------------------------------------

             Summary: cannot use trace when doing streaming parse calls
                 Key: DAFFODIL-2624
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2624
             Project: Daffodil
          Issue Type: Bug
          Components: Back End, Debugger
    Affects Versions: 3.2.1, 2.7.0
            Reporter: Mike Beckerle


I am using SAPI and writing a streaming message parser. It calls the dp.parse repeatedly to parse the data, grabbing one message at a time from the data stream.

I need to enable tracing so I can see why a parse fails on the 4th message.

But this does not work:
{code:java}
dp = pf.onPath("/")
.withValidationMode(ValidationMode.Off)
.withDebuggerRunner(new TraceDebuggerRunner())
.withDebugging(true)
{code}

Each call to parse calls notifyDebugging, which calls setDebugging, which checks that the position of the data input stream is bitPos0b == 0. But in a streaming situation, the bitPos0b won't be zero except when parsing at the start of the stream.

Backtrace:
{code}
java.lang.IllegalStateException: Must call before any access to data

	at org.apache.daffodil.io.DataInputStreamImplMixin.setDebugging(DataInputStreamImplMixin.scala:28)
	at org.apache.daffodil.io.DataInputStreamImplMixin.setDebugging$(DataInputStreamImplMixin.scala:27)
	at org.apache.daffodil.io.InputSourceDataInputStream.setDebugging(InputSourceDataInputStream.scala:786)
	at org.apache.daffodil.processors.parsers.PState.notifyDebugging(PState.scala:452)
	at org.apache.daffodil.processors.DataProcessor.parse(DataProcessor.scala:444)
	at org.apache.daffodil.sapi.DataProcessor.parse(Daffodil.scala:747)
	at com.owlcyberdefense.p8.MessageParser.parse(MessageParser.scala:66)
{code}

It is also questionable if this Java IllegalStateException should be getting thrown all the way to top level here. Since this is SAPI, this is probably Ok, but I would have expected Daffodil to issue an invariant failed here. This bug is an internal Daffodil issue, and not something SAPI uses should be having to think about catching. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)