This is one example of counting down twice. There are a lot of places
calling destroySocket, the best would have been to pass a SocketWrapper
instead of long and keep a AtomicBoolean to track if destroy has been called
on it.

if (running && !paused) {
        // Hand this socket off to an appropriate processor
        if (!processSocketWithOptions(socket)) {
                countDownConnection();
                // Close socket and pool right away
                destroySocket(socket);
        }
} else {
        countDownConnection();
        // Close socket and pool right away
        destroySocket(socket);
} 


Then the actual implementation of destroySocket(long) does the same thing,
it counts it down again.


    private void destroySocket(long socket) {
        // If not running the socket will be destroyed by
        // parent pool or acceptor socket.
        // In any case disable double free which would cause JVM core.
        destroySocket(socket, running);
    }

    private void destroySocket(long socket, boolean doIt) {
        // Be VERY careful if you call this method directly. If it is called
        // twice for the same socket the JVM will core. Currently this is
only
        // called from Poller.closePollset() to ensure kept alive
connections
        // are closed when calling stop() followed by start().
        if (doIt && socket != 0) {
            Socket.destroy(socket);
            countDownConnection();
        }
    }

> -----Original Message-----
> From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
> Sent: Tuesday, June 12, 2012 9:21 PM
> To: Tomcat Developers List
> Subject: "WARNING: Incorrect connection count" when running testsuite
> for APR/native 1.1.24
> 
> Hi!
> 
> I run the testsuite for Tomcat trunk with APR connector with release
> candidate for Tomcat Native 1.1.24, on WinXP 32-bit.
> 
> The testsuite passes successfully, but looking closer into log files I
> see many occurrences of the following warning:
> 
> 12.06.2012 21:13:43 org.apache.tomcat.util.net.AbstractEndpoint
> countDownConnection
> WARNING: Incorrect connection count, multiple socket.close called on
> the same socket.
> 
> There are ~50 tests when it fails, the first one being
> org.apache.catalina.authenticator.TestFormAuthenticator
> 
> It sounds like there are cases when BZ 53173 (connection counting and
> maxConnections) is not fixed yet for APR connector.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org



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

Reply via email to