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

Steve Lawrence resolved DAFFODIL-3079.
--------------------------------------
    Fix Version/s: 4.2.0
       Resolution: Fixed

Fixed in commit edee1e2e1a609194110f0e6f87e91decd6f0cbab

> 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
>             Fix For: 4.2.0
>
>
> 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)

Reply via email to