stevedlawrence commented on PR #905:
URL: https://github.com/apache/daffodil/pull/905#issuecomment-1374005969

   As I re-reviewed this, I got thinking that this may not completely solve the 
hanging thread problem (though I think this fix is still correct and needed).
   
   For example, say we have an XMLReader parsing some XML and sending events to 
our DaffodilUnparseContentHandler, and assume it's sent a bunch of events and 
the coroutine stuff is doing it's thing with a separate thread. Then the 
XMLReader hits somthing that isn't valid and the *XMLReader* (not our 
ContentHandler) throws a SAXException. When this happens, it doesn't notify the 
ContentHandler in any way that it's not going to get anymore events. In our 
specific case, that means our coroutine thread is going to hang since it still 
things more threads are on the way.
   
   In the generic case it means there's no way for a ContentHandler to know 
when to clean up state in an error case. It can't differentiate between "more 
events sure are taking a long time to arrive" vs "no more events are ever 
coming". Seems like a flaw in the SAX API...
   
   I guess we could have some function that users must call if the XMLReader 
throws an exception that would allow us to shutdown the coroutine thread. But I 
don't think there's any way to force a user to call that function, so it's not 
a great API...
   
   Any other thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to