You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/06/13 05:51:40 UTC

[Bug 53406] New: Stack overflow in connector

https://issues.apache.org/bugzilla/show_bug.cgi?id=53406

          Priority: P2
            Bug ID: 53406
          Assignee: dev@tomcat.apache.org
           Summary: Stack overflow in connector
          Severity: normal
    Classification: Unclassified
          Reporter: fhanik@apache.org
          Hardware: PC
            Status: NEW
           Version: 7.0.27
         Component: Connectors
           Product: Tomcat 7

found against trunk on Jun 18, 2012

SEVERE:
java.lang.StackOverflowError
        at
org.apache.catalina.core.StandardContextValve.event(StandardContextValve.java:128)
        at org.apache.catalina.valves.ValveBase.event(ValveBase.java:204)
        at
org.apache.catalina.core.StandardHostValve.event(StandardHostValve.java:223)
        at org.apache.catalina.valves.ValveBase.event(ValveBase.java:204)
        at org.apache.catalina.valves.ValveBase.event(ValveBase.java:204)
        at
org.apache.catalina.core.StandardEngineValve.event(StandardEngineValve.java:110)
        at
org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:209)
        at
org.apache.coyote.http11.Http11NioProcessor.event(Http11NioProcessor.java:124)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:569)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)
        at
org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:999)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:596)
        at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53406] Stack overflow in connector

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53406

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
The following are remarkable points in this stacktrace:

> org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:730)
> org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1008)

NioEndpoint$Poller.add(NioChannel socket, int interestOps):
[[[
            if (close) {
                processSocket(socket, SocketStatus.STOP, false);
            }
]]]

> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.longPoll(Http11NioProtocol.java:277)

[[[
            } else {
                //...
                socket.getSocket().getPoller().add(socket.getSocket());
]]]

so this happens with an application that uses Comet (those event() calls), when
longPoll() is processed, but endpoint is being closed at the same time.

It looks like SocketStatus.STOP value is not being honored. The poller#close
flag is inaccessible from outside.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53406] Stack overflow in connector

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53406

--- Comment #2 from Filip Hanik <fh...@apache.org> ---
Thanks for the analysis.

Here is what I think will fix it

Index: java/org/apache/coyote/http11/Http11NioProcessor.java
===================================================================
--- java/org/apache/coyote/http11/Http11NioProcessor.java       (revision
1349898)
+++ java/org/apache/coyote/http11/Http11NioProcessor.java       (working copy)
@@ -155,7 +155,7 @@

         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

-        if (error) {
+        if (error || status==SocketStatus.STOP) {
             return SocketState.CLOSED;
         } else if (!comet) {
             if (keepAlive) {

What this does, is that it prevents reuse of connections after a Comet
transaction has been notified of a STOP event.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53406] Stack overflow in connector

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53406

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
I was thinking along the same lines but fixing it in the Adaptor rather than
just for NIO. The issue with my fix is that it somewhat abused the error flag
(by changing it's meaning to mean "close the connection for any reason" rather
than "something went wrong".

Your fix is clearer as to intention but it needs to be made to APR too. I'll so
that now unless you beat me to it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53406] Stack overflow in connector

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53406

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Fixed for trunk and 7.0.x and will be included in 7.0.28 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org