0

I'm indexing MySQL tables with Hibernate Search and it takes some time. After that Exceptions are thrown:

Communications link failure The last packet successfully received from the server was 239 757 milliseconds ago.

The last packet sent successfully to the server was 30 milliseconds ago.

Could not commit Hibernate transaction Communications link failure during commit(). Transaction resolution unknown.

Indexing is done in a method annotated with @Transactional(readOnly = true) .

MySQL server has in my.cnf directive: wait_timeout = 60.

How can I instruct Spring/Hibernate to not close active transaction? I'm using HikariCP as a dataSource.

Thank you.

Xdg
  • 1,735
  • 2
  • 27
  • 42
  • Can you actually post the full stack trace(s)? Also it looks like you are dealing with a database setup/communication error. Not so much to do with Hibernate Search. Have you seen this post - http://stackoverflow.com/questions/6865538/solving-a-communications-link-failure-with-jdbc-and-mysql? How do your connection settings look like? – Hardy Jul 22 '14 at 11:01
  • Thank you for the link, I haven't seen it before. I've changed wait_timeout to 3 hours and error disappeared. But I don't like this solution so I will try some tips from your link. Thanks. – Xdg Jul 22 '14 at 11:35

1 Answers1

1

You need to set the HikariCP idleTimeout and maxLifetime to something less than your my.cnf timeouts. See the answer in the HikariCP FAQ.

brettw
  • 10,664
  • 2
  • 42
  • 59