Grails gorm not reconnecting to mysql on Communications link failure

110 views
Skip to first unread message

Dany Yacoub

unread,
Aug 14, 2018, 9:48:32 AM8/14/18
to 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

unread,
Aug 14, 2018, 11:19:21 AM8/14/18
to 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

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

unread,
Aug 25, 2018, 3:58:05 PM8/25/18
to 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

unread,
Sep 6, 2018, 4:00:32 AM9/6/18
to 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

Reply all
Reply to author
Forward
0 new messages