[
https://issues.apache.org/jira/browse/DAFFODIL-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17486040#comment-17486040
]
Steve Lawrence commented on DAFFODIL-2626:
------------------------------------------
One potential solution: what if we impose a restriction that all references to
a global decl must have the same alignment as the global decl (i.e. you cannot
override alignment properties on a global decl)? For example, this would be a
schema definition error:
{code:xml}
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="foo" dfdl:alignmentUnits="bits" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="foo" dfdl:alginmentUnits="bytes">
...
</xs:element>
{code}
With this restriction, our alignment optimization algorithm doesn't need to
look at all possible enclsoing terms. We instead only ever need to look at the
lexical parent and get the alignment from that, and we'll know that all
references to this global decl will have the same alignment.
I imagine few schemas would ever run into this restriction. And if they did, a
work around would just be to add multiple decls for different alignments, or
add some dummy sequences with different alignment. It requires some extra
schema, but I would think it would be rarely needed.
Thoughts?
> 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)