https://bz.apache.org/bugzilla/show_bug.cgi?id=65708

            Bug ID: 65708
           Summary: uncaptured exception make  SocketProcessor container
                    has a httpconnection leak
           Product: Tomcat 8
           Version: 8.5.23
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: newch...@sina.com
  Target Milestone: ----

Created attachment 38104
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38104&action=edit
the line 1476 encounter a exception

tomcat-embed-core-8.5.23.jar

if org.apache.tomcat.util.net.NioEndpoint.SocketProcessor#doRun  encounter
exception before connection closed and it is not CancelledKeyException class,it
will trigger throw exception to the third catch code block. 


if org.apache.tomcat.util.net.NioEndpoint.SocketProcessor#doRun (line 1453 --
line 1485)

                if (handshake == 0) {
                    SocketState state = SocketState.OPEN;
                    // Process the request from this socket
                    if (event == null) {
                        state = getHandler().process(socketWrapper,
SocketEvent.OPEN_READ);
                    } else {
                        state = getHandler().process(socketWrapper, event);
                    }
                    if (state == SocketState.CLOSED) {
                        close(socket, key);
                    }
                } else if (handshake == -1 ) {
                    close(socket, key);
                } else if (handshake == SelectionKey.OP_READ){
                    socketWrapper.registerReadInterest();
                } else if (handshake == SelectionKey.OP_WRITE){
                    socketWrapper.registerWriteInterest();
                }
            } catch (CancelledKeyException cx) {
                socket.getPoller().cancelledKey(key);
            } catch (VirtualMachineError vme) {
                ExceptionUtils.handleThrowable(vme);
            } catch (Throwable t) {
                log.error("", t);
                socket.getPoller().cancelledKey(key);
            } finally {
                socketWrapper = null;
                event = null;
                //return to cache
                if (running && !paused) {
                    processorCache.push(this);
                }
            }


and in the catch block  if the first line code(line 1476) encounter exception,
the second line code(line 1477) will be skip. and the socket will be not
closed, ,and make a socket connection  leak.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to