DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13973

Tomcat shutdown Loop





------- Additional Comments From [EMAIL PROTECTED]  2002-10-28 08:03 -------
First of all that's the environment I've used:
- JDK 1.4.1_01
- Tomcat 4.1.12
- Struts 1.0.2

The DB is Oracle 8.1.7 and the JDBC Driver is the classes12.zip provided by 
Oracle.

That's the Struts-config setup for the db connection:
-----------------------------------
<struts-config>
 <data-sources>
  <data-source
    key="application"
    autoCommit="false"
    description="Cavanna database"
    driverClass="oracle.jdbc.driver.OracleDriver"
    maxCount="10"
    minCount="2"
    user="cavadev"
    password="cavadev"
    url="jdbc:oracle:thin:@altea5:1521:altea5"
  />
 </data-sources>
...
<struts-config>
-----------------------------------

You can see the problem only stopping the server Tomcat after the startup: You 
will see that stat tomcat never shutdown.

I've debugged the struts source code and I've seen that the close method in the 
GenericDataSource class try to close all the active connections:

---------------------------------------------
    public void close() throws SQLException {

        if (closed)
            throw new SQLException("close:  Data Source already closed");
        if (debug >= 1)
            log(" close()");

        // Shut down all active connections
        while (activeCount > 0) {
            GenericConnection conn = (GenericConnection) getConnection();
            conn.getConnection().close();
            activeCount--;
        }

        // Mark this data source as having been closed and release our driver
        closed = true;
        driver = null;

    }
-----------------------------------

but the getConnection method create a new one ever loop...

            ...
            // Create a new connection if we are not yet at the maximum
            if (activeCount < maxCount) {
                Connection connection = createConnection();
                if (connection != null) {
                    try {
                        ping(connection);
                    } catch (SQLException e) {
                        throw e;
                    }
                    useCount++;
                    if (debug >= 3)
                        log("   Return new connection, activeCount=" +
                            activeCount + ", useCount=" + useCount);
                    return (connection);
                }
            }
            ...

that's all you need to simulate the issue...

Thank's

Pierfranco Lai

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to