Skip to content

Feature Request: Keep Alive or Auto Reconnect for MySQL/MariaDB #513

@ChrisTVH

Description

@ChrisTVH

Information

While working on my network, I realized that due to how my host's databases are configured, when there is no activity, it disconnects from the databases and does not reconnect.

There are two ways to solve this:

  • The plugin tries to reconnect.
  • An option to define a time interval for sending a response to the database to maintain the connection.

This already exists in luckperms to maintain the connection to the database; it is called keepalive-time.

Reason

Well, currently that gives me an error when the connection is lost due to lack of activity, which leads me to reload the plugin to reestablish the connection.

[16:55:20 ERROR]: java.sql.SQLException: Connection has already been closed
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.libs.ormlite.jdbc.BaseJdbcConnectionSource.getReadWriteConnection(BaseJdbcConnectionSource.java:148)
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.libs.ormlite.jdbc.BaseJdbcConnectionSource.getReadOnlyConnection(BaseJdbcConnectionSource.java:138)
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.libs.ormlite.dao.BaseDaoImpl.queryForId(BaseDaoImpl.java:229)
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.libs.ormlite.dao.BaseDaoImpl.queryForSameId(BaseDaoImpl.java:319)
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.libs.ormlite.dao.BaseDaoImpl.createIfNotExists(BaseDaoImpl.java:379)
[16:55:20 ERROR]:       at xyz.jonesdev.sonar.api.database.controller.VerifiedPlayerController.lambda$add$3(VerifiedPlayerController.java:231)
[16:55:20 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[16:55:20 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[16:55:20 ERROR]:       at java.base/java.lang.Thread.run(Thread.java:1583)

This is the error I get. It could be considered a bug, but it also involves requesting a new feature, which is why it is here.

Additional information

No response

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions