You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Katherine Morgan <km...@tenzeng.com> on 2007/02/22 01:27:07 UTC
Re: [2] MySQL connection problem
I had the same problem and found a solution.
For completeness, here is the exception:
203504578 (invoker-Thread-82) [ ConnectionFactory.java:95 :ERROR]
---- runtime exception report
--------------------------------------------------
There was an error getting a Minerva datasource.
Exception: java.lang.RuntimeException
Message: Unable to setTransactionIsolation: Communication link failure:
java.io.EOFException, underlying cause: null
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1395)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2237)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2218)
at
com.mysql.jdbc.Connection.setTransactionIsolation(Connection.java:913)
at
org.ofbiz.minerva.pool.jdbc.xa.wrapper.XAConnectionImpl.setTransactionIsolation(XAConnectionImpl.java:117)
at
org.ofbiz.minerva.pool.jdbc.xa.XAConnectionFactory.prepareObject(XAConnectionFactory.java:412)
at org.ofbiz.minerva.pool.ObjectPool.getObject(ObjectPool.java:645)
at
org.ofbiz.minerva.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:355)
at
org.ofbiz.entity.transaction.MinervaConnectionFactory.getConnection(MinervaConnectionFactory.java:56)
at
org.ofbiz.entity.jdbc.ConnectionFactory.tryGenericConnectionSources(ConnectionFactory.java:92)
at
org.ofbiz.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:158)
at
org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:104)
at
org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:82)
at
org.ofbiz.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:268)
at
org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:374)
at
org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:358)
at
org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:549)
at
org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:520)
at
org.ofbiz.entity.datasource.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:90)
at
org.ofbiz.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:1248)
at
org.ofbiz.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:1304)
at
org.ofbiz.service.job.PersistedServiceJob.getJob(PersistedServiceJob.java:282)
at
org.ofbiz.service.job.PersistedServiceJob.init(PersistedServiceJob.java:129)
at
org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:74)
at org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:226)
at java.lang.Thread.run(Thread.java:534)
Reproduce:
The wait_timeout variable on the mysql db is set to 28800 seconds (8 hours)
by default.
If you set this to a much smaller amount, eg 10 seconds, then this error can
be reproduced much quicker!
set GLOBAL wait_timeout=10;
set SESSION wait_timeout=10;
set GLOBAL interactive_timeout=10;
set SESSION interactive_timeout=10;
Specs:
opentaps-0.9.1-all-platforms
mysql 5.0.22
connector versions: 3.0.17, 5.0.4
Solution:
Have a look at the org.ofbiz.minerva.pool.ObjectPool and PoolGCThread class,
the javadoc is fabulous. In particular look at the following methods, and
also inspect the default values:
ObjectPool.setGCEnabled(boolean);
ObjectPool.setIdleTimeoutEnabled(boolean);
ObjectPool.setTimestampUsed(boolean);
In MinervaConnectionFactory the pools are created. Add the following lines:
pds.setGCEnabled(true);
pds.setIdleTimeoutEnabled(true);
pds.setTimestampUsed(true);
(I made my code take configuration parameters from entityengine.xml, see the
jotmJdbcElement variable).
Debug:
base/config/debug.properties
log4j.logger.org.ofbiz.minerva=DEBUG
You can then see the thread working to recycle the connections.
--
View this message in context: http://www.nabble.com/MySQL-connection-problem-tf2486297.html#a9092103
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: [2] MySQL connection problem
Posted by "David E. Jones" <jo...@hotwaxmedia.com>.
This sounds like a good thing to make configurable. You mentioned
some code in your message. Is that something you could contribute to
OFBiz (ie attach to a Jira issue)?
-David
On Feb 21, 2007, at 5:27 PM, Katherine Morgan wrote:
>
> I had the same problem and found a solution.
>
> For completeness, here is the exception:
>
> 203504578 (invoker-Thread-82) [ ConnectionFactory.java:95 :ERROR]
> ---- runtime exception report
> --------------------------------------------------
> There was an error getting a Minerva datasource.
> Exception: java.lang.RuntimeException
> Message: Unable to setTransactionIsolation: Communication link
> failure:
> java.io.EOFException, underlying cause: null
>
> ** BEGIN NESTED EXCEPTION **
>
> java.io.EOFException
>
> STACKTRACE:
>
> java.io.EOFException
> at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1395)
> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:
> 1539)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
> at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2237)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2218)
> at
> com.mysql.jdbc.Connection.setTransactionIsolation(Connection.java:913)
> at
> org.ofbiz.minerva.pool.jdbc.xa.wrapper.XAConnectionImpl.setTransaction
> Isolation(XAConnectionImpl.java:117)
> at
> org.ofbiz.minerva.pool.jdbc.xa.XAConnectionFactory.prepareObject
> (XAConnectionFactory.java:412)
> at org.ofbiz.minerva.pool.ObjectPool.getObject
> (ObjectPool.java:645)
> at
> org.ofbiz.minerva.pool.jdbc.xa.XAPoolDataSource.getConnection
> (XAPoolDataSource.java:355)
> at
> org.ofbiz.entity.transaction.MinervaConnectionFactory.getConnection
> (MinervaConnectionFactory.java:56)
> at
> org.ofbiz.entity.jdbc.ConnectionFactory.tryGenericConnectionSources
> (ConnectionFactory.java:92)
> at
> org.ofbiz.entity.transaction.JNDIFactory.getConnection
> (JNDIFactory.java:158)
> at
> org.ofbiz.entity.transaction.TransactionFactory.getConnection
> (TransactionFactory.java:104)
> at
> org.ofbiz.entity.jdbc.ConnectionFactory.getConnection
> (ConnectionFactory.java:82)
> at
> org.ofbiz.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:
> 268)
> at
> org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement
> (SQLProcessor.java:374)
> at
> org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement
> (SQLProcessor.java:358)
> at
> org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:549)
> at
> org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:520)
> at
> org.ofbiz.entity.datasource.GenericHelperDAO.findByPrimaryKey
> (GenericHelperDAO.java:90)
> at
> org.ofbiz.entity.GenericDelegator.findByPrimaryKey
> (GenericDelegator.java:1248)
> at
> org.ofbiz.entity.GenericDelegator.findByPrimaryKey
> (GenericDelegator.java:1304)
> at
> org.ofbiz.service.job.PersistedServiceJob.getJob
> (PersistedServiceJob.java:282)
> at
> org.ofbiz.service.job.PersistedServiceJob.init
> (PersistedServiceJob.java:129)
> at
> org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:
> 74)
> at org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:226)
> at java.lang.Thread.run(Thread.java:534)
>
>
> Reproduce:
>
> The wait_timeout variable on the mysql db is set to 28800 seconds
> (8 hours)
> by default.
>
> If you set this to a much smaller amount, eg 10 seconds, then this
> error can
> be reproduced much quicker!
>
> set GLOBAL wait_timeout=10;
> set SESSION wait_timeout=10;
> set GLOBAL interactive_timeout=10;
> set SESSION interactive_timeout=10;
>
> Specs:
>
> opentaps-0.9.1-all-platforms
> mysql 5.0.22
> connector versions: 3.0.17, 5.0.4
>
> Solution:
>
> Have a look at the org.ofbiz.minerva.pool.ObjectPool and
> PoolGCThread class,
> the javadoc is fabulous. In particular look at the following
> methods, and
> also inspect the default values:
> ObjectPool.setGCEnabled(boolean);
> ObjectPool.setIdleTimeoutEnabled(boolean);
> ObjectPool.setTimestampUsed(boolean);
>
> In MinervaConnectionFactory the pools are created. Add the
> following lines:
>
> pds.setGCEnabled(true);
> pds.setIdleTimeoutEnabled(true);
> pds.setTimestampUsed(true);
>
> (I made my code take configuration parameters from
> entityengine.xml, see the
> jotmJdbcElement variable).
>
> Debug:
>
> base/config/debug.properties
> log4j.logger.org.ofbiz.minerva=DEBUG
>
> You can then see the thread working to recycle the connections.
>
>
> --
> View this message in context: http://www.nabble.com/MySQL-
> connection-problem-tf2486297.html#a9092103
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>