Hi,

I'm experimenting with the new tomcat 6 NIO connector to get a
CometProcessor servlet running. I've run into a problem that I hope
you guys can help me with. I'm testing a servlet that looks like this:

public final class QueryEvent extends HttpServlet implements CometProcessor {
   public void event(CometEvent event) throws IOException, ServletException {
       System.out.println("event.getEventType() = " + event.getEventType());
   }
}

that is, simply printing to std.out (catalina.out) whenever a comet
event arrives.  Then, I connect to the servlet with wget (or firefox,
same result) which immediately hangs, waiting for data. This is
expected, since I haven't sent anything back to the client, let alone
ended the connection. However, ending the connection by ctrl-c'ing
wget (or pressing stop in firefox) results in tomcat suddenly jumps
from almost no CPU usage to 100% usage until I kill it. I've included
a sample stack trace obtained with jstack while tomcat was at 100% CPU
usage.

Some info:
1. I'm running tomcat 6.0.10 on JDK 1.6
2. Only one BEGIN event is seen by the event(CometEvent event) method,
no ERRORs or READs are received.
3. The tomcat is running locally, so I've only seen this happen in the
loopback configuration, I don't know the behaviour when connecting to
a remote tomcat instance.
4. No other connections to the tomcat instance is made while the test
is running.

- elias

2007-04-06 17:25:18
Full thread dump Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing):

"Attach Listener" daemon prio=10 tid=0x083d3400 nid=0x7b7 waiting on
condition [0x00000000..0x00000000]
  java.lang.Thread.State: RUNNABLE

"http-8443-4" daemon prio=10 tid=0x08476400 nid=0x795 runnable
[0xb5501000..0xb5501ee0]
  java.lang.Thread.State: RUNNABLE
       at sun.nio.ch.EPollArrayWrapper.interrupt(Native Method)
       at sun.nio.ch.EPollArrayWrapper.interrupt(EPollArrayWrapper.java:211)
       at sun.nio.ch.EPollSelectorImpl.wakeup(EPollSelectorImpl.java:170)
       - locked <0x8c7ac958> (a java.lang.Object)
       at 
org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1080)
       at 
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1099)
       at 
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1092)
       at 
org.apache.coyote.http11.Http11NioProcessor.event(Http11NioProcessor.java:781)
       at 
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.event(Http11NioProtocol.java:562)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1452)
       at java.lang.Thread.run(Thread.java:619)

"http-8443-3" daemon prio=10 tid=0x08475800 nid=0x794 in Object.wait()
[0xb5552000..0xb5552e60]
  java.lang.Thread.State: WAITING (on object monitor)
       at java.lang.Object.wait(Native Method)
       at java.lang.Object.wait(Object.java:485)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.await(NioEndpoint.java:1394)
       - locked <0x8c7f17c8> (a org.apache.tomcat.util.net.NioEndpoint$Worker)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1419)
       at java.lang.Thread.run(Thread.java:619)

"http-8443-2" daemon prio=10 tid=0x08374800 nid=0x793 in Object.wait()
[0xb55a4000..0xb55a41e0]
  java.lang.Thread.State: WAITING (on object monitor)
       at java.lang.Object.wait(Native Method)
       - waiting on <0x8c7f1858> (a
org.apache.tomcat.util.net.NioEndpoint$Worker)
       at java.lang.Object.wait(Object.java:485)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.await(NioEndpoint.java:1394)
       - locked <0x8c7f1858> (a org.apache.tomcat.util.net.NioEndpoint$Worker)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1419)
       at java.lang.Thread.run(Thread.java:619)

"http-8443-1" daemon prio=10 tid=0x084ad800 nid=0x792 in Object.wait()
[0xb5601000..0xb5602160]
  java.lang.Thread.State: WAITING (on object monitor)
       at java.lang.Object.wait(Native Method)
       at java.lang.Object.wait(Object.java:485)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.await(NioEndpoint.java:1394)
       - locked <0x8c7ab0f0> (a org.apache.tomcat.util.net.NioEndpoint$Worker)
       at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1419)
       at java.lang.Thread.run(Thread.java:619)

"http-8443-Poller-0" daemon prio=10 tid=0x084c2400 nid=0x790 runnable
[0xb5652000..0xb56530e0]
  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 <0x8c7ab1f0> (a sun.nio.ch.Util$1)
       - locked <0x8c7ab200> (a java.util.Collections$UnmodifiableSet)
       - locked <0x8c7ab1b0> (a sun.nio.ch.EPollSelectorImpl)
       at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
       at 
org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1175)
       at java.lang.Thread.run(Thread.java:619)

"http-8443-Acceptor-0" daemon prio=10 tid=0x0847f000 nid=0x78f
runnable [0xb56a3000..0xb56a4060]
  java.lang.Thread.State: RUNNABLE
       at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
       at 
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
       - locked <0x8c65e2b8> (a java.lang.Object)
       at 
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:955)
       at java.lang.Thread.run(Thread.java:619)

"ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon
prio=10 tid=0x08497800 nid=0x78e waiting on condition
[0xb56f4000..0xb56f4fe0]
  java.lang.Thread.State: TIMED_WAITING (sleeping)
       at java.lang.Thread.sleep(Native Method)
       at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1549)
       at java.lang.Thread.run(Thread.java:619)

"Low Memory Detector" daemon prio=10 tid=0x0808e000 nid=0x78a runnable
[0x00000000..0x00000000]
  java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=10 tid=0x0808c400 nid=0x789 waiting on
condition [0x00000000..0xb5a648f8]
  java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x0808b000 nid=0x788 runnable
[0x00000000..0xb5ab5ec0]
  java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=10 tid=0x08082000 nid=0x787 in Object.wait()
[0xb5b40000..0xb5b41160]
  java.lang.Thread.State: WAITING (on object monitor)
       at java.lang.Object.wait(Native Method)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
       - locked <0x8c585668> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
       at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x08081000 nid=0x786 in
Object.wait() [0xb5b91000..0xb5b920e0]
  java.lang.Thread.State: WAITING (on object monitor)
       at java.lang.Object.wait(Native Method)
       at java.lang.Object.wait(Object.java:485)
       at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
       - locked <0x8c5856f8> (a java.lang.ref.Reference$Lock)

"main" prio=10 tid=0x08059000 nid=0x784 runnable [0xb7e00000..0xb7e012b8]
  java.lang.Thread.State: RUNNABLE
       at java.net.PlainSocketImpl.socketAccept(Native Method)
       at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
       - locked <0x8c7ab2e8> (a java.net.SocksSocketImpl)
       at java.net.ServerSocket.implAccept(ServerSocket.java:450)
       at java.net.ServerSocket.accept(ServerSocket.java:421)
       at org.apache.catalina.core.StandardServer.await(StandardServer.java:389)
       at org.apache.catalina.startup.Catalina.await(Catalina.java:616)
       at org.apache.catalina.startup.Catalina.start(Catalina.java:576)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

"VM Thread" prio=10 tid=0x08077800 nid=0x785 runnable

"VM Periodic Task Thread" prio=10 tid=0x0808f800 nid=0x78b waiting on condition

JNI global references: 645

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to