Конфигурация c3po и прерванные подключения mysql
Я получил много Aborted connection
сообщения на стороне БД - [Note] Aborted connection 11043 to db: 'mysql' user: 'mysql' host: Got an error reading communication packets
,
У меня нет проблем с приложением и БД, но мне интересно, почему я получаю эти сообщения.
Может ли это быть потому, что hibernate.c3p0.idle_test_periods
выше чем hibernate.c3p0.timeout
?
Вот файл конфигурации Hibernate:
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
Журнал доступа к БД:
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@41d8a248] on IDLE CHECK has SUCCEEDED.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#1] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@7d10203] on IDLE CHECK.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@264d3257] on IDLE CHECK.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@ea7e8fb] on IDLE CHECK.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@264d3257] on IDLE CHECK has SUCCEEDED.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#1] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@7d10203] on IDLE CHECK has SUCCEEDED.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#0] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@2cb753e7] on IDLE CHECK.>
DEBUG [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9l7vpkfr1egte0l|cf2bf60]-HelperThread-#2] [UID:, MSG_ID:] [com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool] <Test of PooledConnection
1 ответ
Решение
Соединения в конце концов становятся устаревшими. Пожалуйста, настройте некоторые проверки подключения. Самое простое, что нужно сделать, - это просто изменить конфигурацию, чтобы
hibernate.c3p0.testConnectionOnCheckout=true
Или см. Документацию c3p0.