users@glassfish.java.net

Re: App Server Complete Deadlock Occurs When HTTP Thread Limit Reached

From: <glassfish_at_javadesktop.org>
Date: Tue, 10 Jul 2007 01:02:14 PDT

Hi.

There is indeed a maximum of five processing threads (checked on Glassfish V2B54)
This small servlet launched from for example IE shows that after five connections new connections are waiting.
Worse, if you launch about 50 connections at the same time, the listener is definitly dead.

Incrementing the Acceptor Threads in glassfish console to 500 seems to allow 50 (exactly) conncurrent connections. No idea why...

------------------------------
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
       
        for(int i = 0; i < 60; i++) {
            out.write("BIP " + Integer.toString(i) + "\n\r");
            out.flush();
            try {
                
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
        
        out.close();
    }
----------------------------------------------------------------------------------

// this code kills the glassfish http listener forever
public class BipReader extends Thread {
    
    /** Creates a new instance of BipReader */
    public static void main(String[] args) throws Exception {
        for(int i= 0; i <150; i++)
            new BipReader().start();
    }
    
    public void run() {
        try {
            URL url = new URL("http://192.17.1.170:8088/BipServlet/BipServlet");
            InputStream in = url.openStream();
            while(true) {
                int c = in.read();
                if(c == -1)
                    break;
                else
                    System.out.print((char) c);
            }
        }
        catch(Exception e) {}
    }
}
[Message sent by forum member 'alpha1' (alpha1)]

http://forums.java.net/jive/thread.jspa?messageID=225894