Problem with MysqlConnectionPoolDataSource Connector/J 8.0.x
Posted by: Hubert Gailly
Date: March 09, 2019 05:52AM

Hello, I cannot use Connector/J 8.0.x with Tomcat 7.0.x and MySQL 8.0.x.
The following behaviour has been spotted on version 8.0.13 and 8.0.15
The same code with Connector/J 5.1.x and MySQL 8.0.x works perfectly just replacing com.mysql.cj.jdbc.MysqlConnectionPoolDataSource by com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource.
The same happens on Windows 10 (development machine) and Windows Server 2012 (production machine).
I am currently using java JVM machine 1.8.0x.
I am using my own Connection Pool Manager which works fine with all other databases and connectors (including MySQL 8.0.x, MySQL 5.0.x, MS SQL Server all versions) for the last 10 years.

When I start a Tomcat Instance I instantiate a Memory Cache for accelerating page display. Total cache filling takes approx. 20 minutes.
After approx. 10 minutes I suddenly get errors and the initiating process hangs totally.
I am totally lost to understand what is happening, I tried so many parameters and debug options with no result (at least always the same error).
I also mentionned that it rarely happens on the same query but almost always after roughly the same amount of time.

In my own code, I have this error caught in my logging system :
ERROR null
java.sql.SQLException
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1218)
at com.mysql.cj.jdbc.StatementWrapper.executeQuery(StatementWrapper.java:566)
at com.daga_web.jdbc.DataSet.init(DataSet.java:168)

In Tomcat Error Log this suddenly get written :
Exception in thread "Thread-5" java.lang.StackOverflowError
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.cj.protocol.ReadAheadInputStream.fill(ReadAheadInputStream.java:107)
at com.mysql.cj.protocol.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:150)
at com.mysql.cj.protocol.ReadAheadInputStream.read(ReadAheadInputStream.java:180)
at java.io.FilterInputStream.read(Unknown Source)
at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:64)
at com.mysql.cj.protocol.a.SimplePacketReader.readMessage(SimplePacketReader.java:108)
at com.mysql.cj.protocol.a.SimplePacketReader.readMessage(SimplePacketReader.java:45)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:61)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:44)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:61)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:44)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:61)

Follow roughly 500 occurences of the same 2 lines
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:44)
at com.mysql.cj.protocol.a.MultiPacketReader.readMessage(MultiPacketReader.java:61)


This is the init of the Connection pool
com.mysql.cj.jdbc.MysqlConnectionPoolDataSource pds = new com.mysql.cj.jdbc.MysqlConnectionPoolDataSource();
pds.setServerName(Server);
pds.setDatabaseName(Database);
pds.setUser(Login);
pds.setPassword(Password);
try
{
pds.setLoginTimeout(10);
}
catch (SQLException ex)
{
}
pds.setPortNumber(port);
pds.setAutoClosePStmtStreams(true);
pds.setAutoReconnectForPools(false);
pds.setUseSSL(false);
pds.setServerTimezone("Europe/Paris");
ConnectionPoolManagerManager.addConnectionPoolManager(Name, pds);


Thanks for any help...

Options: ReplyQuote




Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.