Steve Lawrence created DAFFODIL-2767:
----------------------------------------
Summary: Mixed content with SAX unparsing hangs coroutine thread
Key: DAFFODIL-2767
URL: https://issues.apache.org/jira/browse/DAFFODIL-2767
Project: Daffodil
Issue Type: Bug
Components: Back End, Unparsing
Affects Versions: 3.4.0
Reporter: Steve Lawrence
Fix For: 3.5.0
When unparsing with the SAX API, we spawn a new thread and run the unparse()
call in that using our custom coroutine implementation. The main SAX thread and
the coroutine unparse thread() using an ArrayBlockingQueue to suspend execution
of one subroutine while the other executes.
However, if the main thread throws an exception then it leaves the corutine
unparse() thread hung, blocked on the ArrayBlockingQueue.
This is exactly what happens if there is mixed content in the infoset we are
unparsing. If mixed content is detected in the DaffodilUnparseContentHander
startElement function then, then we throw an exception that can be caught by
the SAX API, but the unparse thread is still running and blocked.
One option is to modify the startElement() function in the main thread to add
state to a SAXEvent when it detects mixed content. When the unparse thread sees
this state it can cause the unparse() thread to finish by throwing an
exception. This will create an UnparseResult that eventually is passed back to
the main thread and coroutine logic can finish.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)