Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-30

AsyncEvent.getAsyncContext() returns null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Alpha8
    • 1.0.0.Alpha7
    • Servlet
    • None

      When an async request processing is started and then dispatched back to the servlet container, AsyncEvent.getAsyncContext() returns null within any AsyncListener invocation (onComplete, onError).

      This is because the HttpServletRequestImpl.asyncContext field is set to null within HttpServletRequestImplasyncRequestDispatched() which is called as part of dispatching async request. This causes a problem as the AsyncContext is needed on AsyncListener. Therefore, AsyncContext should not probably be kept in a field but rather put into a stack (since the servlet to which the request is dispatched could in theory also start async processing and so on...).

      The problem can be reproduced by the test: AsyncListenerOnErrorTest.testAsyncListenerOnErrorInvoked2()

      Note that the test passes but NPE can be seen in the log.

            sdouglas1@redhat.com Stuart Douglas
            rhn-engineering-jharting Jozef Hartinger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: