[jboss-jira] [JBoss JIRA] (WFLY-3526) Servlet 3 - async-mode - onTimeout not triggered

Günther Grill (JIRA) issues at jboss.org
Fri Jun 20 04:09:24 EDT 2014


Günther Grill created WFLY-3526:
-----------------------------------

             Summary: Servlet 3 - async-mode - onTimeout not triggered
                 Key: WFLY-3526
                 URL: https://issues.jboss.org/browse/WFLY-3526
             Project: WildFly
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Server
    Affects Versions: 8.1.0.Final, 8.0.0.Final
            Reporter: Günther Grill
            Assignee: Jason Greene


With asynchronous mode of servlets a long running process never times out.

In my tests I have a async servlet which calls starts a long running process. That process take longer then the configured timeout. But here never a timeout comes. The long running process can complete.

According to the spec, the servlet should run into a timeout and the AsyncListener#onTimeout method is called for registered listeners.

But this never happens in Wildfly 8.


Here is a test servlet
@WebServlet(urlPatterns = {"/AsyncServlet"}, asyncSupported = true)

public class AsyncServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;

    public AsyncServlet() {

        super();

    }

    @Override

    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

        res.setContentType("text/html");

        AsyncContext ac = null;

        if (req.isAsyncStarted()) {

            ac = req.getAsyncContext();

        } else {

            ac = req.startAsync();

        }

        ac.setTimeout(5000);

        ac.addListener(new AsyncListener() {

            @Override

            public void onTimeout(AsyncEvent event) throws IOException {

                System.out.println("onTimeout");

            }

            @Override

            public void onStartAsync(AsyncEvent event) throws IOException {

                System.out.println("onStartAsync");

            }

            @Override

            public void onError(AsyncEvent event) throws IOException {

                System.out.println("onError");

            }

            @Override

            public void onComplete(AsyncEvent event) throws IOException {

                // end of async processing -> end of response time

                System.out.println("onComplete");

            }

        });

        // this processor takes longer then the timeout. e.g. 15 sec

        AsyncProcessorA ap = new AsyncProcessorA(ac); // background processor

        ac.start(ap); // start async processing

    }

}



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)



More information about the jboss-jira mailing list