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

PollSelectorImpl's FD leak for asyncServlet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 10.0.0.CR5
    • 8.1.0.Final
    • Web (Undertow)
    • None
    • Hide

      Create a new thread in AsyncServlet then writer big data into response, Then request this servlet repeatedly,Then run linux cmd :
      lsof -p [JAVAPID]|grep pipe|wc -l
      you will see this number increasesd,but not never decrease

      Show
      Create a new thread in AsyncServlet then writer big data into response, Then request this servlet repeatedly,Then run linux cmd : lsof -p [JAVAPID] |grep pipe|wc -l you will see this number increasesd,but not never decrease

    Description

      AsyncServlet doGet() like this:

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

      { resp.setContentType("text/html;charset=UTF-8"); AsyncContext ctx = req.startAsync(); new Thread(new Executor(ctx)).start(); }

      public class Executor implements Runnable {
      private AsyncContext ctx = null;

      public Executor(AsyncContext ctx)

      { this.ctx = ctx; }

      public void run() {
      try

      { char[] data = new char[1024 * 1024 * 1]; PrintWriter out = ctx.getResponse().getWriter(); out.write(data); out.flush(); ctx.complete(); }

      catch (Exception e)

      { e.printStackTrace(); }

      }
      do request this Servlet some times , run linux cmd :
      lsof -p [JAVAPID]|grep pipe|wc -l
      this number increases by two every one request,but never decrease! when this number up to OS's open file limit everything is not OK.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            chanlehero_sn 浩 陈 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: