MySQL / Hibernate randomly has a "Communication Failure",

We have a webapp working with Hibernate / C3PO 4.1.4.Final, Jetty, Java 6 and Mysql 5.1.63.

javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: link for communication failure

The last packet successfully received from the server was 238,519 milliseconds ago. The last packet successfully sent to the server was 0 milliseconds ago.

Our persistence.xml property section looks like this:

  <properties>
        <property name="hibernate.show_sql" value="false"/>
        <!--Begin Credentials -->
        <property name="hibernate.connection.url"
                  value="${rp.config.db.url}&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
        <property name="hibernate.connection.username" value="${rp.config.db.user}"/>
        <property name="hibernate.connection.password" value="${rp.config.db.password}"/>
        <!--End Credentials -->
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
        <property name="hibernate.dialect" value="com.printlogix.rp.server.utils.Mysql5BitBooleanDialect"/>
        <property name="hibernate.hbm2ddl.auto" value="validate"/>
        <!--C3PO -->
        <property name="hibernate.connection.provider_class"
                  value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider"/>
        <property name="hibernate.c3p0.acquire_increment" value="25"/>
        <property name="hibernate.c3p0.idle_test_period" value="60"/>
        <property name="hibernate.c3p0.timeout" value="120"/>
        <property name="hibernate.c3p0.max_size" value="150"/>
        <property name="hibernate.c3p0.min_size" value="25"/>
        <property name="hibernate.c3p0.max_statement" value="0"/>
        <property name="hibernate.c3p0.preferredTestQuery" value="select 1;"/>

    </properties>

Our MySQL timeout is set to 600 seconds. We do not know how this happens 1/5 times. The server has a very small load, the database is relatively small, all servlets work in a matter of seconds.

Does anyone have any ideas?

+5
source share
3 answers

. MySQL 8 ​​, , , 8 ​​, . , "wait_timeout" 14 , , 15 , MySQL, ( Master-Master ). . , 15 , ( ).:) , , wait_timeout 10 , , , 10 . , MySQL reset wait_timeout. , .:)

0

I think this post could help. If this is the case, increasing the value wait_timeoutonly postpones the time more than solving the problem.

The problem may be related to this:

  • You are opening a hibernation session
  • Do a few things that take longer than the wait_timeout value of your database
  • You are trying to use this hibernation session. A message appears that you comment here.

I have registered a case in here if you are interested.

0
source

All Articles