You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/12/13 20:40:45 UTC

DO NOT REPLY [Bug 32441] - [dbcp] SQLException When PoolablePreparedStatement Already Closed

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=32441





------- Additional Comments From regs@akom.net  2006-12-13 11:40 -------
This may perhaps qualify as a separate bug but here goes anyway:

This has much bigger impact (than I've seen indicated so far) when used with
mysql connector 5.0.4 (and perhaps other versions), and commons-pool 1.3 .  
Mysql Connection's have the annoying ability to close themselves (specifically
when there is a communication breakdown with the server and they are not in High
Availability mode).  

Since the isClosed method checks both the local flag AND the underlying
connection's, it returns true, meaning that the mentioned code in close() throws
instead of returning the object to the pool!!!   This quickly starves the object
pool and causes the developer a lot of grief.

I am currently patching DBCP for internal use, replacing the isClosed() method
with a simple:

	public boolean isClosed() throws SQLException {
		return _closed;
	}

While I acknowledge that the check of the wrapped connections' closed state may
be useful for something else, it is not compatible with the current close()
method - the two unmatched strategies cause a disastrous situation.

As for how to reproduce this behavior (if desired), the application I own is a
very high throughput multithreaded server running on high powered boxes which
writes medium sized chunks (20K) of data to MySQL using 50 threads concurrently,
some of the writing is done via stored procedures.  Generally the "mysql
self-closing" behavior occurs only when mysql server is overwhelmed, or if I
slow it down intentionally by doing a dump, etc.  I've also seen this problem
happen when mysql server crashes naturally or via "kill -9", or when disk is full.

References:

com.mysql.jdbc.Connection:Line 3200:
------------------------
if ((sqlState != null) &&
sqlState.equals(SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE)) 
  cleanup(sqlE);
------------------------
(Cleanup method sets it to closed)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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