2016-12-20 22 views
0

DB側にAborted connectionというメッセージがたくさん届きました - [Note] Aborted connection 11043 to db: 'mysql' user: 'mysql' host: Got an error reading communication packetsc3po設定とmysql接続が中止されました

私はアプリケーションとDBに問題はありませんが、なぜこれらのメッセージが表示されるのでしょうか。

hibernate.c3p0.idle_test_periodshibernate.c3p0.timeoutよりも大きい可能性がありますか?

hibernate.id.new_generator_mappings=false 
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider 
hibernate.format_sql=false 
hibernate.max_fetch_depth=3 
hibernate.show_sql=false 
hibernate.use_sql_comments=false 
hibernate.connection.driver_class=com.mysql.jdbc.Driver 
hibernate.dialect=com.p.db.pMySqlDialect 
hibernate.connection.release_mode=after_transaction 
hibernate.c3p0.acquire_increment=1 
hibernate.c3p0.idle_test_period=10 
hibernate.c3p0.timeout=0 
hibernate.c3p0.max_statements=0 
hibernate.c3p0.min_size=3 
hibernate.c3p0.max_size=400 
hibernate.c3p0.preferredTestQuery=select 1 
hibernate.c3p0.acquireRetryAttempts=5 
hibernate.c3p0.acquireRetryDelay=1000 
hibernate.c3p0.breakAfterAcquireFailure=false 
hibernate.c3p0.testConnectionOnCheckin=false 
hibernate.c3p0.testConnectionOnCheckout=false 

DBアクセスログ:

DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [[email protected]] on IDLE CHECK has SUCCEEDED.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#1] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [[email protected]] on IDLE CHECK.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [[email protected]] on IDLE CHECK.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [[email protected]] on IDLE CHECK.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [[email protected]] on IDLE CHECK has SUCCEEDED.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#1] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [[email protected]] on IDLE CHECK has SUCCEEDED.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [[email protected]] on IDLE CHECK.> 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection 

答えて

1

の接続は、最終的に古くなって行く。ここ

は、Hibernate設定ファイルです。いくつかの接続テストを設定してください。最も簡単な方法は自分の設定を変更することになるので、

hibernate.c3p0.testConnectionOnCheckout=true 

または、c3p0 docsを参照してください。

+0

ありがとうございますが、私はそれが自分の問題にどのように関係しているのかよくわかりません。 'testConnectionOnCheckout = true'を追加するとパフォーマンスが低下しますか? – Berlin

+1

あなたのアプリケーションが古い接続を見ている - 有効ではなくなった接続+は、RDBMSと通信しようとするとエラーを生成します。 Connectionをテストするようにc3p0を設定した場合、プールはこれらの古い接続を検出し、アプリケーションがそれらの接続を認識する前に除去します。 'testConnectionOnCheckout = true'はパフォーマンスコストを課しますが、最近のJDBCドライバを使用している限り、コストは控えめです(高速なConnection.isValid()メソッドを使用します)。チェックアウト時のテストコストが許容できない場合は、チェックインとアイドルテストでテストを使用できます。しかし、おそらく –

+0

私はそれを試してみる必要はありません、ありがとう! – Berlin

関連する問題