users@glassfish.java.net

Grizzly consumes 100% CPU in SelectorThread.doSelect if client disconnects

From: <glassfish_at_javadesktop.org>
Date: Mon, 09 Jun 2008 04:11:52 PDT

Hello,

we currently have an issue with the grizzly web connector. If a HTTP client disconnects unexpected, the Glassfish starts to use nearly 100% CPU.

Doing jstack every some seconds shows this alternating stack pattern:

"SelectorThread-10081" prio=10 tid=0x086b0c00 nid=0x2e32 runnable [0x876ad000..0x876ae030]
    java.lang.Thread.State: RUNNABLE
     at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
     at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:184)
     at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
     at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
     - locked <0x95987eb8> (a sun.nio.ch.Util$1)
     - locked <0x95987ea8> (a java.util.Collections$UnmodifiableSet)
     - locked <0x95973b68> (a sun.nio.ch.EPollSelectorImpl)
     at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
     at com.sun.enterprise.server.ss.provider.ASSelector.select(ASSelector.java:133)
     at com.sun.enterprise.web.connector.grizzly.SelectorThread.doSelect(SelectorThread.java:1337)
     at com.sun.enterprise.web.connector.grizzly.SelectorThread.startListener(SelectorThread.java:1284)
      - locked <0x95968270> (a [Ljava.lang.Object;)
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.startEndpoint(SelectorThread.java:1247)
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.run(SelectorThread.java:1223)

and

"SelectorThread-10080" prio=10 tid=0x87dc9400 nid=0x2e31 runnable [0x876fe000..0x876ff0b0]
     java.lang.Thread.State: RUNNABLE
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.doSelect(SelectorThread.java:1356)
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.startListener(SelectorThread.java:1284)
      - locked <0x95968760> (a [Ljava.lang.Object;)
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.startEndpoint(SelectorThread.java:1247)
      at com.sun.enterprise.web.connector.grizzly.SelectorThread.run(SelectorThread.java:1223)

At some other place I read that this is due to some issue with the NIO select implemenation:

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

So I guess a workaround could be to change the web connector from grizzly to coyote:

    com.sun.enterprise.web.useCoyoteConnector=true

Is this a good idea? What are the differences between both connectors?

Thanks for any suggestions!

Jörg
[Message sent by forum member 'jthoennes' (jthoennes)]

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