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 2026/04/16 18:08:00 UTC
[jira] [Updated] (DAFFODIL-3079) Saving schema leads to "Invariant broken. No value for delay. Containing object not initialized?"
[ https://issues.apache.org/jira/browse/DAFFODIL-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Lawrence updated DAFFODIL-3079:
-------------------------------------
Description:
Attempting run packageDaffodilBin to create a saved parser with the below schema:
{code:xml}
<element name="field" type="xs:unsignedInt"
dfdl:inputValueCalc="{ fn:round-half-to-even(fn:error('error message')) }"/>
{code}
Leads to this stack trace:
{code}
org.apache.daffodil.lib.exceptions.Abort: Invariant broken. No value for delay. Containing object not initialized? ID Symbol:TypeNode object box(TypeNode)
org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
at org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
at org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
at org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce$(Serialize.scala:25)
at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce$lzyINIT1(Delay.scala:70)
at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce(Delay.scala:70)
at org.apache.daffodil.lib.util.PreSerialization.serializeObject(Serialize.scala:62)
at org.apache.daffodil.lib.util.PreSerialization.serializeObject$(Serialize.scala:25)
at org.apache.daffodil.lib.util.Delay.serializeObject(Delay.scala:70)
at org.apache.daffodil.lib.util.Delay.writeObject(Delay.scala:126)
...
{code}
After some debugging, the Delay that is not initialized is Nothing.childrenDelay. So it seems fn:error creates a Nothing that must be serialized, and it seems the Nothing.childrenDelay is not evaluated, at least in some cases. It's also possible the parentDelay is also not evaluated.
I suspect the issue is that we need to ensure that during compilation all parent/children of the TypeNode tree are evaluated, including the Nothing TypeNode, to ensure they can all be serialized. I imagine in most cases it just happens naturally as we compile expressions, but in this specific case it does not.
Note that the schema to reproduce this issue is a bit contrived, but is technically legal, and has come up in a schema generator where building these kinds of expressions isn not uncommon
was:
Attempting run packageDaffodilBin to create a saved parser with the below schema:
{code:xml}
<element name="field" type="xs:unsignedInt"
dfdl:inputValueCalc="{ fn:round-half-to-even(fn:error('cannot unparse to illegal value')) }"/>
{code}
Leads to this stack trace:
{code}
org.apache.daffodil.lib.exceptions.Abort: Invariant broken. No value for delay. Containing object not initialized? ID Symbol:TypeNode object box(TypeNode)
org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
at org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
at org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
at org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce$(Serialize.scala:25)
at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce$lzyINIT1(Delay.scala:70)
at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce(Delay.scala:70)
at org.apache.daffodil.lib.util.PreSerialization.serializeObject(Serialize.scala:62)
at org.apache.daffodil.lib.util.PreSerialization.serializeObject$(Serialize.scala:25)
at org.apache.daffodil.lib.util.Delay.serializeObject(Delay.scala:70)
at org.apache.daffodil.lib.util.Delay.writeObject(Delay.scala:126)
...
{code}
After some debugging, the Delay that is not initialized is Nothing.childrenDelay. So it seems fn:error creates a Nothing that must be serialized, and it seems the Nothing.childrenDelay is not evaluated, at least in some cases. It's also possible the parentDelay is also not evaluated.
I suspect the issue is that we need to ensure that during compilation all parent/children of the TypeNode tree are evaluated, including the Nothing TypeNode, to ensure they can all be serialized. I imagine in most cases it just happens naturally as we compile expressions, but in this specific case it does not.
Note that the schema to reproduce this issue is a bit contrived, but is technically legal, and has come up in a schema generator where building these kinds of expressions isn not uncommon
> Saving schema leads to "Invariant broken. No value for delay. Containing object not initialized?"
> -------------------------------------------------------------------------------------------------
>
> Key: DAFFODIL-3079
> URL: https://issues.apache.org/jira/browse/DAFFODIL-3079
> Project: Daffodil
> Issue Type: Bug
> Components: Front End
> Affects Versions: 4.1.0
> Reporter: Steve Lawrence
> Priority: Major
>
> Attempting run packageDaffodilBin to create a saved parser with the below schema:
> {code:xml}
> <element name="field" type="xs:unsignedInt"
> dfdl:inputValueCalc="{ fn:round-half-to-even(fn:error('error message')) }"/>
> {code}
> Leads to this stack trace:
> {code}
> org.apache.daffodil.lib.exceptions.Abort: Invariant broken. No value for delay. Containing object not initialized? ID Symbol:TypeNode object box(TypeNode)
> org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
> org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
> org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
> org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
> at org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:153)
> at org.apache.daffodil.lib.exceptions.Assert$.invariantFailed(Assert.scala:201)
> at org.apache.daffodil.lib.util.Delay.preSerialization(Delay.scala:120)
> at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce(Serialize.scala:47)
> at org.apache.daffodil.lib.util.PreSerialization.preSerializationOnlyOnce$(Serialize.scala:25)
> at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce$lzyINIT1(Delay.scala:70)
> at org.apache.daffodil.lib.util.Delay.preSerializationOnlyOnce(Delay.scala:70)
> at org.apache.daffodil.lib.util.PreSerialization.serializeObject(Serialize.scala:62)
> at org.apache.daffodil.lib.util.PreSerialization.serializeObject$(Serialize.scala:25)
> at org.apache.daffodil.lib.util.Delay.serializeObject(Delay.scala:70)
> at org.apache.daffodil.lib.util.Delay.writeObject(Delay.scala:126)
> ...
> {code}
> After some debugging, the Delay that is not initialized is Nothing.childrenDelay. So it seems fn:error creates a Nothing that must be serialized, and it seems the Nothing.childrenDelay is not evaluated, at least in some cases. It's also possible the parentDelay is also not evaluated.
> I suspect the issue is that we need to ensure that during compilation all parent/children of the TypeNode tree are evaluated, including the Nothing TypeNode, to ensure they can all be serialized. I imagine in most cases it just happens naturally as we compile expressions, but in this specific case it does not.
> Note that the schema to reproduce this issue is a bit contrived, but is technically legal, and has come up in a schema generator where building these kinds of expressions isn not uncommon
--
This message was sent by Atlassian Jira
(v8.20.10#820010)