Jetty
  1. Jetty
  2. JETTY-597

Jetty does not close the socket when client has close the socket.

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 7.0.0pre1
    • Fix Version/s: None
    • Component/s: Bayeux
    • Labels:
      None
    • Environment:
      linux 2.6
    • Number of attachments :
      0

      Description

      I wrote a sample code to see how jetty close the socket. but I found that jetty won't close the socket even after the client closed the peer-socket. this is my source code, very simple:

      public static void main(String[] args) throws Exception {

      Handler handler = new AbstractHandler() {
      public void handle(String target, HttpServletRequest request,
      HttpServletResponse response, int dispatch)
      throws IOException, ServletException {
      Continuation cont = ContinuationSupport.getContinuation(
      request, null);
      if(cont.isPending())

      { response.setContentType("text/html"); response.setStatus(HttpServletResponse.SC_OK); response.getWriter().println("<h1>Hello</h1>"); ((Request) request).setHandled(true); }

      else

      { cont.suspend(0); }

      }
      };

      Server server = new Server();
      Connector connector = new SelectChannelConnector();
      connector.setPort(8080);
      server.setConnectors(new Connector[]

      { connector }

      );
      server.setHandler(handler);
      server.start();
      }

      i can reproduce this bug by following way:

      1. open web browser to access http://locahost:8080/hello . as the first time, it is suspended by continuation, and wait for being resumed.
      2. close the web browser to simulate the user's leaving.
      3. run command "nestat -tanp | grep 8080" to watch the tcp connection:

      tcp 0 0 127.0.0.1:43465 127.0.0.1:8080 FIN_WAIT2 -
      tcp6 0 0 :::8080 :::* LISTEN 22866/java
      tcp6 1 0 127.0.0.1:8080 127.0.0.1:43465 CLOSE_WAIT 22866/java

      abviously, CLOSE_WAIT status tells me that the socket is waiting for being closed. I think, since i have closed the web browser, the socket of server should be close at once.

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Temp
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: