LuckPerms

LuckPerms

41.4k Downloads

Adding groups instantly to remote DB causes loss of data.

andrewkm opened this issue ยท 1 comments

commented

CC'ing this ticket as it's related: #1488

This long standing issue has finally been tracked down.
It seems sending several commands such as:

[04:12:45] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add main_ExtCommands main' for player 'valese'.
[04:12:45] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add main_Tombstone main' for player 'valese'.
[04:12:45] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add main_Flying main' for player 'valese'.
[04:12:45] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add main_FlyingPlus main' for player 'valese'.
[04:12:45] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add supporter' for player 'valese'.

At the EXACT same time, causes a loss of data if being executed on a server communicating with a remote DB. Sending these commands at the exact same time to a server with a local DB causes no loss of data.

With the above commands the user should end up with groups:

  • main_ExtCommands
  • main_Tombstone
  • main_Flying
  • main_FlyingPlus
  • supporter

However they end up with random combinations of the groups, such as:

  • main_Tombstone
  • main_Flying
  • supporter

or

  • main_ExtComands
  • main_FlyingPlus

etc...

It seems the commands being sent at the exact same time causes some sort of fault when pushing to a remote database.

Server setup is as such:

BuyCraft sends to server1.
server1 attempts to write to server2 (mysql server)

If we set up a spigot instance on server2 (mysql server) and send the commands directly there, this problem cannot be reproduced whatsoever.

As such we're now sending commands to server2 to mitigate this problem, however a fix for the issue, or further investigation advise would be nice. (Perhaps a MySQL confliction with pushing that many commands at once, however don't see how this would be a problem as LogBlock sends out thousands a minute). Something definitely going on here, would be nice to get to the bottom of it.

commented

I'm unable to reproduce.

My setup:

  • running a server on my laptop, LP v4.4.1 (to try to mirror what you were testing with)
  • connecting to a MySQL instance in a physically different location (a different city to me), approx 50ms ping

Using the same test code as before:

var console = server.getConsoleSender();

function dispatchCommand(command) {
	server.dispatchCommand(console, command);
	logger.info("dispatching command: " + command)
}

Commands.create()
	.assertOp()
	.handler(function(c) {
		for (var i = 0; i < 50; i++) {
			dispatchCommand("lp user c1d60c50-70b5-4722-8057-87767557e50d permission set test-" + i);
		}
	})
	.registerAndBind(registry, "lptest");

Log output, as you can see the commands all run successfully.
https://gist.github.com/lucko/f87c4a1851f466eb39e330e739d324b5

Also tried using the latest v5 build, same thing, all successful.
https://gist.github.com/lucko/4bcc708a21babf99c312f321eaaf39ec