[
https://issues.apache.org/jira/browse/DAFFODIL-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17487280#comment-17487280
]
Steve Lawrence commented on DAFFODIL-2626:
------------------------------------------
> This second problem is more fundamental. The runtime is somehow not
> propagating the position information for the buffered data output streams as
> it is figured out.
Tracked this issue down to this chunk of code:
[https://github.com/apache/daffodil/blob/main/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SpecifiedLength2.scala#L179-L194]
That code, as it mentions, is too pessimistic and we do not propagate the known
fixed length of the prefix element through the suspensions/DataOutputStream, so
the AlignFillUnparser isn't able to determine that it actually is aligned at
runtime. I've modified that code to return the value of
{{maybeUnparserTargetLengthInBitsEv}} and the test no longer deadlocks. But
that obviously won't work for other tests where the actual unparsed length
won't match the target length. But at least points to the right solution of
making this code less pessimistic.
And the comment at the bottom of that block I think provides a good solution,
though, I'm not sure yet the best way to determine when we can know for sure
when {{maybeUnparserTargetLengthInBitsEv}} will match the actual length. And I
guess we don't even need to be perfect--anything will be an improvement over
what we have now. And cases like this test are very obvious and should be easy
to check.
> Circular deadlock when computing stored length around prefixed-length elements
> ------------------------------------------------------------------------------
>
> Key: DAFFODIL-2626
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2626
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 3.2.1
> Reporter: Mike Beckerle
> Assignee: Steve Lawrence
> Priority: Critical
>
> I have a small schema with a messageLength element as the first element,
> which has outputValueCalc on the message payload.
> The message payload contains prefixed-length strings.
> I get a deadlock on unparsing:
> {code}
> org.apache.daffodil.tdml.TDMLExceptionImpl: (Implementation: daffodil)
> SuspensionDeadlockException: Runtime Schema Definition Error:
> Expressions/Unparsers are circularly deadlocked (mutually defined):
> - SimpleTypeRetryUnparserSuspendableOperation for messageLength
> - ElementUnusedUnparserSuspendableOperation for payload
> - AlignmentFillUnparserSuspendableOperation for address
> Schema context: messageLength Location line 59 column 18 in
> file:/tmp/s__3044777217024912267.dfdl.xsd
> Data location was preceding byte 0
> {code}
> See test test_computedLengthAroundPrefixedLengths1u
> Test test_computedLengthAroundPrefixedLengths1p is the same thing, just
> testing the parse direction.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)