Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to a Percona MySQL server which has SSL connectivity available #8

Open
galexrt opened this issue Mar 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@galexrt
Copy link

galexrt commented Mar 13, 2022

Describe the bug
Using a Percona MySQL database server 5.7 version that has SSL connectivity available for clients can't be used with PunishControl, see below exception.

It would be great if Punishcontrol has a config option to allow passing custom HikariCP / connection properties to the database driver.
(e.g., besides in this case useSSL=false, I would like to pass some other connection properties for the setup I'm running to the database driver)

[17:52:52 ERROR]: -------------------------------------------------------
[17:52:52 ERROR]: PunishControl bootstrap failed due to PoolInitializationException
[17:52:52 ERROR]: Can't connect to database
[17:52:52 ERROR]: PunishControl will now halt
[17:52:52 ERROR]: -------------------------------------------------------
[17:52:52 ERROR]: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
[17:52:52 ERROR]: 	at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
[17:52:52 ERROR]: 	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
[17:52:52 ERROR]: 	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
[17:52:52 ERROR]: 	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
[17:52:52 ERROR]: 	at dev.simplix.core.database.sql.HikariDataSourceCreator.createSource(HikariDataSourceCreator.java:22)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.loadHikariDatasourceFromSettings(DatabaseManager.kt:24)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.access$loadHikariDatasourceFromSettings(DatabaseManager.kt:16)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager$enable$1.invoke(DatabaseManager.kt:52)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager$enable$1.invoke(DatabaseManager.kt:43)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DataSourceLoadResult$Companion.of(DataSourceLoadResult.kt:15)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.enable(DatabaseManager.kt:43)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.common.impl.PunishControlBootstrap.enable(PunishControlBootstrap.kt:251)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.bungeecord.PunishControlBungeeCordPluginBootstrap.onEnable(PunishControlBungeeCordPluginBootstrap.kt:66)
[17:52:52 ERROR]: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:52:52 ERROR]: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[17:52:52 ERROR]: 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[17:52:52 ERROR]: 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[17:52:52 ERROR]: 	at dev.simplix.plugins.punishcontrol.bungeecord.PunishControlPlugin.onEnable(PunishControlPlugin.java:119)
[17:52:52 ERROR]: 	at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:315)
[17:52:52 ERROR]: 	at net.md_5.bungee.BungeeCord.start(BungeeCord.java:290)
[17:52:52 ERROR]: 	at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
[17:52:52 ERROR] [com.zaxxer.hikari.pool.HikariPool]: HikariPool-1 - Exception during pool initialization.
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:416) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:128) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) ~[?:?]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[?:?]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) ~[?:?]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[?:?]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100) ~[?:?]
	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81) ~[?:?]
	at dev.simplix.core.database.sql.HikariDataSourceCreator.createSource(HikariDataSourceCreator.java:22) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.loadHikariDatasourceFromSettings(DatabaseManager.kt:24) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.access$loadHikariDatasourceFromSettings(DatabaseManager.kt:16) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager$enable$1.invoke(DatabaseManager.kt:52) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager$enable$1.invoke(DatabaseManager.kt:43) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DataSourceLoadResult$Companion.of(DataSourceLoadResult.kt:15) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.storage.loader.DatabaseManager.enable(DatabaseManager.kt:43) ~[?:?]
	at dev.simplix.plugins.punishcontrol.common.impl.PunishControlBootstrap.enable(PunishControlBootstrap.kt:251) ~[?:?]
	at dev.simplix.plugins.punishcontrol.bungeecord.PunishControlBungeeCordPluginBootstrap.onEnable(PunishControlBungeeCordPluginBootstrap.kt:66) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at dev.simplix.plugins.punishcontrol.bungeecord.PunishControlPlugin.onEnable(PunishControlPlugin.java:119) ~[?:?]
	at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:315) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at net.md_5.bungee.BungeeCord.start(BungeeCord.java:290) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:334) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:164) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1342) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	... 30 more
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
	at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:172) ~[?:?]
	at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103) ~[?:?]
	at sun.security.ssl.TransportContext.kickstart(TransportContext.java:240) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:448) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) ~[?:?]
	at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:336) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:325) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:164) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1342) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[waterfall.jar:git:Waterfall-Bootstrap:1.18-R0.1-SNAPSHOT:e767b40:480]
	... 30 more

Expected behavior
A clear and concise description of what you expected to happen.

Platform

  • Which platform are you on: Bungeecord (Waterfall)
  • Which version is your server on (Eg: 1.8 / 1.12 / 1.16 / etc.) build 480
  • Are you using a fork (Eg: Waterfall / Paper / Travertine / etc.) Waterfall
  • Are there any other plugins that might be interfering? No.
  • Server Java-Version: [e.g. 1.8.0_291] 17.0.3

Files

  • Debug log does not show the exception.

To Reproduce

I can post a docker run command for a Percona mysql database server to allow for easy reproduceing of this exception.

@galexrt galexrt added the bug Something isn't working label Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant