com.mysql.jdbc.CommunicationsException: Communications link failure (glassfish+mysql))

231 Views Asked by At

We are using glassfish-3.1.2.18 with java 1.8.0_161 and mysql. The application gets hung periodically(say every 2 months). we could see this error in the logs

============================================================================= Last packet sent to the server was 6 ms ago.

STACKTRACE:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException MESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

STACKTRACE:

java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)

=====================================================================

Finally it ends up in

====================================================================

java.lang.OutOfMemoryError: Java heap space

Can any one help me how to debug? I can't see any problem in our code that can cause connection leak.

Some background info : We use jdbc connection which received from jdbc connection pool in glassfish.

Issue starts in quartz job that runs in background.

Heap space error stack:

org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.OutOfMemoryError: Java heap space] at org.quartz.core.JobRunShell.run(JobRunShell.java:227) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) Caused by: java.lang.OutOfMemoryError: Java heap space

0

There are 0 best solutions below