commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hontvari Jozsef (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DBCP-329) SQLException: Already closed.
Date Mon, 29 Mar 2010 14:53:28 GMT

    [ https://issues.apache.org/jira/browse/DBCP-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850936#action_12850936
] 

Hontvari Jozsef commented on DBCP-329:
--------------------------------------

I inserted some additional logging to debug this case, and indeed it hides another exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 8,064,672 milliseconds ago.  The
last packet sent successfully to the server was 8,064,672 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3317)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1941)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2264)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	...
Caused by: java.net.SocketException: Connection reset by peer: socket write error
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3298)
	... 34 common frames omitted

So the latter exception is not related to DBCP, only the "already closed" in my original report.


> SQLException: Already closed.
> -----------------------------
>
>                 Key: DBCP-329
>                 URL: https://issues.apache.org/jira/browse/DBCP-329
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: MySQL
>            Reporter: Hontvari Jozsef
>
> After upgrading to 1.4 I see such exceptions logged:
> java.sql.SQLException: Already closed.
> 	at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)
> 	at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)
> 	...
> This should never happen. According to the Connection.close() javadoc: 
> "Calling the method close on a Connection object that is already closed is a no-op."
>  
> Moreover, I am pretty sure that our code does not close the connection twice. But because
the close() is called in a finally block, it is possible that this exception hides another
exception. Unfortunately I cannot reproduce it, even though it occurs regularly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message