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

Steve Lawrence resolved DAFFODIL-2768.
--------------------------------------
    Resolution: Fixed

Fixed in commit 3f31018d3a5756736c8408a173df31f97595bb43

> SAX unparse can lead to a hanging thread if the XMLReader stops sending events
> ------------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2768
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2768
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, Unparsing
>    Affects Versions: 3.4.0
>            Reporter: Steve Lawrence
>            Assignee: Steve Lawrence
>            Priority: Major
>             Fix For: 4.1.0
>
>
> When unparsing with the SAX API (using the DaffodilUnparseContentHandler), we 
> spawn an unparse thread to mimic the behavior of coroutines. If the 
> ContentHandler detects an issue in the incoming events (e.g. mixed content) 
> or the unparse thread/coroutine is notified and finishes, then the thread 
> shuts down as expected.
> However, if the ContentHandler throws an unexpected exception during 
> processing (which would be a bug) or the XMLReader throws an exception (e.g. 
> invalid XML), then the unparse coroutine/thread is never notified and is 
> stuck waiting for more events that will never come. And nothing in the SAX 
> API notifies the DaffodilUnparseContentHandler so that it can cause the 
> thread to stop. It seems the SAX API assumes all ContentHandlers are 
> stateless and will just be garbaged collected, but that isn't the case with 
> our DaffodilUnparseContentHandler.
> One potential solution is to add a reset/cleanup method to the 
> DaffodilUnparseContentHandler, and very clearly document that if this isn't 
> called after an XMLReader is exits, then it is possible that the thread will 
> hang and never be shutdown.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to