Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2767

Mixed content with SAX unparsing hangs coroutine thread

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.5.0
    • Back End, Unparsing
    • None

    Description

      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.

      Attachments

        Activity

          People

            slawrence Steve Lawrence
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: