Grails gorm not reconnecting to mysql on Communications link failure

已查看 114 次
跳至第一个未读帖子

Dany Yacoub

未读,
2018年8月14日 09:48:322018/8/14
收件人 Grails Dev Discuss
Hello,

I have a process on Grails 2 that handles requests from the DB...every 2 to 3 weeks I get the error

SQL Error: 0, SQLState: 08S01
 spi
.SqlExceptionHelper  - Communications link failure


The last packet successfully received from the server was 1,681 milliseconds ago.  The last packet sent successfully to the server was 1,681 milliseconds ago.


The worst part is that the application doesn't reconnect and my process keeps hanging until i restart tomcat myself

- I've checked the configuration on my.cnf
- I've added all the info in my datasource configuration for reconnect, timeouts and validation queries
- The connection to the DB is never idle since I query the DB every second to retrieve records
- I'm catching the throwable when this error occurs but I'm still unable to do anything about it
Does anyone have any hint of how to solve this issue ?

Ronald Kayondo

未读,
2018年8月14日 11:19:212018/8/14
收件人 grails-de...@googlegroups.com
I would recommend switching to  a more reliable data-source like HIKARI. It makes extra effort to make sure that the database connection is valid before it hands over the connection to the client code.

Recently hosted Grails system on a managed database server where connections held for more than minute would get killed. Hikari came to the rescue even with the default settings.

Ronald

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/380a366e-39a8-43a5-8d60-56ba80cea90b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Ronald. K

Дмитрий Нескажуев

未读,
2018年8月25日 15:58:052018/8/25
收件人 Grails Dev Discuss
I think, you can solve it by configuration of database pool like c3p0 or tomcat jdbc pool  https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

вторник, 14 августа 2018 г., 15:48:32 UTC+2 пользователь Dany Yacoub написал:

Dany Yacoub

未读,
2018年9月6日 04:00:322018/9/6
收件人 grails-de...@googlegroups.com
Hello, 

Sorry I took so long to respond, but I was checking if the HIKARI datasource works, and unfortunately yesterday the issue happened again. and with the HIKARI datasource it couldn’t reconnect alone. I had to restart tomcat.

Any change I should do ? or do you suggest something else ?

Thanks,
Dany

回复全部
回复作者
转发
0 个新帖子