Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3962

onComplete for async listeners not always called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 9.0.0.CR1
    • 8.0.0.Final, 8.1.0.Final
    • Web (Undertow)
    • None

    Description

      I have a servlet filter that does

      chain.doFilter(requestWrapper, responseWrapper);
      if (request.isAsyncStarted())

      { asyncListener = request.getAsyncContext().createListener(JsonPAsyncListener.class); request.getAsyncContext().addListener(asyncListener, requestWrapper, responseWrapper); }

      And (sometimes) this works well so that the onComplete() method of the listener is called.
      But this does not happen always. In some (repeatable) condition none of the callback methods in my AsyncListener are called.

      I was first thinking that the servlet (resteasy) behind chain.doFilter() is so fast that it completes
      before I can add the listener.
      But then I tried adding a Thread.sleep() in the RE code which did not change anything.
      Similar when I do a startAsync() and add the listener before calling chain.doFilter()

      This happens both on Wfly 8.0 and 8.1

      Basically it boils down that if the "backend" uses Futures.immediateFuture(result) , onComplete is not called.

      I have created a as small as possible war file + a read me on how to drive that via curl.

      See https://github.com/pilhuhn/misc/tree/master/web-goo

      I just added 2 examples to the readme file that show that if no
      wrapping by the filter is requested, the resteasy code works with
      both Futures.immediate... and Futures.transform(...)

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            pilhuhn Heiko Rupp
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: