commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Gould (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DBCP-244) Connection socket hangs sporadically in DBCP 1.2.2 but not 1.2.1
Date Tue, 30 Sep 2008 21:47:44 GMT

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

Carl Gould commented on DBCP-244:
---------------------------------

I'm seeing this too. I get one thread with the following dump (see below) and then the rest
all block on 

org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)


This is on Windows Server 2003 Standard Ed, Java 1.5.0_11, DBCP 1.2.2, Pool 1.4 MySQL Connector/J
5.0.4 

We used DBCP 1.2.1 for years, and never saw this. It seems to happen after a network drop
between DBCP and the database. 

Of course, we upgraded to DBCP 1.2.2 to fix the bug in 1.2.1 that caused the pool to leak
connections when the underlying connection closed itself due to socket error and then the
framework didn't catch the "already closed" exception... 

Anyhow, I digress, the stack trace of the blocked thread is: 

java.net.SocketInputStream.socketRead0(Native Method) 
java.net.SocketInputStream.read(Unknown Source) 
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113) 
com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)

com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188) 
com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1910) 
com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:501) 
com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:971) 
com.mysql.jdbc.Connection.createNewIO(Connection.java:2670) 
com.mysql.jdbc.Connection.(Connection.java:1531) 
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) 
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)

org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)

org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974) 
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84) 
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
...[ application code ]

> Connection socket hangs sporadically in DBCP 1.2.2 but not 1.2.1
> ----------------------------------------------------------------
>
>                 Key: DBCP-244
>                 URL: https://issues.apache.org/jira/browse/DBCP-244
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Fedora Core 3, MySQL 4.1.22. with the latest driver (5.07). Exceptions
only occur in the "job processing" JVM, which sits idle for long periods of time and occasionally
wakes up to interact with the database.
>            Reporter: ori
>             Fix For: 1.3
>
>
> I think I've traced an exception to DBCP's code.
> Communication with the database is hanging sporadically in a production environment.
If I don't set the socketTimeout property on the underlying connection, it will hang forever.
With the socketTimeout property, I get the following exception:
> -------
> com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying
exception:
> ** BEGIN NESTED EXCEPTION **
> java.net.SocketTimeoutException
> MESSAGE: Read timed out
> STACKTRACE:
> java.net.SocketTimeoutException: Read timed out
>        at java.net.SocketInputStream.socketRead0(Native Method)
>        at java.net.SocketInputStream.read(SocketInputStream.java:129)
>        at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
>        at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
>        at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
>        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1994)
>        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2411)
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:3250)
>        at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1355)
>        at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1270)
>        at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
> ...
> -------
> It always happens in an infrequently used JVM (not an app server handling frequent connections).
So it's likely the offending connection was asleep for a long time before the exception occurs.

> I've confirmed that this issue only occurs using 1.2.2 and not 1.2.1. I've been looking
through the changelogs but can't find anything that would cause this behavior.
> Does somebody familiar with the codebase have any idea what change (1.2.1->1.2.2)
could be causing this behavior? 
> Thanks

-- 
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