AuthMeReloaded icon indicating copy to clipboard operation
AuthMeReloaded copied to clipboard

authme is doing MySQL on server thread

Open ghost opened this issue 5 years ago • 9 comments

Before reporting an issue make sure you are running the latest build of the plugin and checked for duplicate issues!

What behaviour is observed:

What happened? huge lag every join

What behaviour is expected:

What did you expect? I expect authme to do MySQL connections on separate thread, yet it does it in main while useAsyncTasks is true

Steps/models to reproduce:

The actions that cause the issue

Plugin list:

This can be found by running /pl

Environment description

Standalone server/Bungeecord network, SQLite/MySql, ... bungeecord, mysql

AuthMe build number:

This can be found by running /authme version 2385

Error Log:

Pastebin/Hastebin/Gist link of the error log or stacktrace (if any)

Configuration:

Pastebin/Hastebin/Gist link of your config.yml file (remember to delete any sensitive data)

ghost avatar May 11 '20 18:05 ghost

It should already do that. Do you have any stacktraces or errors that highlight this behavior?

TuxCoding avatar May 12 '20 12:05 TuxCoding

Well you can see at the log that's not AuthMe running on the server thread. It's

[21:07:59] [Paper Watchdog Thread/ERROR]: com.kirelcodes.miniaturepets.pets.Pet.(Pet.java:153)

If you mean this message:

[21:07:58] [AuthMeMYSQLPool connection adder/INFO]: [NetworkInterceptor] Intercepted outgoing connection to host '51.83.99.210'

That's normal, but there is no information that this is on the main thread.

EDIT: You can follow the stacktrace.

  1. Skript running an effect task.
  2. JavaScript user defined action is performed.
  3. Bukkit command is executed
  4. MinaturePets handles the command and performs database action.

However AuthMe could have trigger those actions after the user logged in, because AuthMe releases the player.

TuxCoding avatar May 12 '20 14:05 TuxCoding

The error is about MinaturePets is waiting for incoming data from the SQL server. There you can see that MinaturePets is doing SQL operations on the main thread, that should be performed asynchronous. This could affect performance. (Your title)

However you can also see that the server thread doesn't continue or there multiple tasks queued that all execute this code that will hold at the same position. AuthMe freezes the player if not logged it. This could cause Skript to queue too many effects and therefore they all report the same stacktrace. Similar there could be a loop inside MiniaturePets

The server thread freeze could also happen if there is a deadlock on the SQL server, another connection is not allowed or the MySQL/MariaDB server is overloaded. AuthMe also establishes MySQL/MariaDB connection. So please check the CPU usage and MySQL/MariaDB server settings (not the plugin settings).

Furthermore you could also try one run without MinaturePets or Skript with AuthMe enabled and observe the log and timings report. Remember Correlation does not imply causation. It's also useful in this case to post the configuration of AuthMe and your Skript plugin to debug it.

In summary (in this order):

  • Please test one run without MinaturePets
  • Same without Skript but with the other two plugins
  • Check the MySQL/MariaDB server settings

TuxCoding avatar May 12 '20 15:05 TuxCoding

Thanks that's what we need

TuxCoding avatar May 13 '20 11:05 TuxCoding

Could you please post your config. I'm trying to reproduce it.

TuxCoding avatar May 13 '20 12:05 TuxCoding

Okay found it. Caching is required here. What is your motivation for disabling it?

TuxCoding avatar May 13 '20 12:05 TuxCoding

That's looks like a big design flaw in our system. I'll open another ticket for discussion. Looks like you found something critical. Thank you.

For now you could disable inventory protection. This should reduce the amount of calls drastically in case the player is not logged or registered and something changed in the inventory.

TuxCoding avatar May 13 '20 12:05 TuxCoding

Might add aswell, noticed there is lag upon some players joining, and noticed there is a nice lagspike when new players join my Network. Re-occuring players dont seem to cause too much of a a lagspike but when a brand new player joins, there is a noticeable lagspike.

LoXR avatar May 17 '20 13:05 LoXR

Aswell will follow up on this, for some reason at times, players (Premium Auth) are needing to /login, But can do commands and jump. Although with that /login its suppose to prevent all that.

LoXR avatar May 24 '20 10:05 LoXR