You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2023/02/01 16:04:00 UTC

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

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

Steve Lawrence resolved DAFFODIL-2624.
--------------------------------------
    Resolution: Fixed

Fixed in commit d06722c94ddfcd691480002f09c24b1829272157

> 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: 2.7.0, 3.2.1
>            Reporter: Mike Beckerle
>            Assignee: Mike McGann
>            Priority: Major
>              Labels: Beginner
>             Fix For: 3.5.0
>
>
> 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.10#820010)