LuckPerms

LuckPerms

41.4k Downloads

Running multiple commands with a tiny/no delay reports success, but doesn't update DB

liam-wiltshire opened this issue · 10 comments

commented

We've had this reported via a customer (I am from Tebex/Buycraft), but we've recently released a new feature called 'push commands' - this means rather than polling for commands to run, we push them to the server over http.

As a side-effect, multiple commands will run near-instantaneously (basically as fast as the server can do it!).

When this happens with LP commands, it looks like the LP permission handles the command, but the DB isn't being updated:

[12:00:31] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add main_ExtCommands main' for player 'valese'.
[12:00:31] [Server thread/INFO]: [BuycraftX] Dispatching command 'lp user b444150b-be76-4e5f-b815-397a386e1794 parent add supporter' for player 'valese'.
[12:00:31] [Server thread/INFO]: [BuycraftX] Dispatching command 'liquidsafe userupdate valese' for player 'valese'.
[12:00:31] [pool-12-thread-1/INFO]: [LP] valese now inherits permissions from main_extcommands in context server=main.
[12:00:31] [luckperms-worker-47/INFO]: [LuckPerms] [Messaging] Sending log with id: 5c4a159a-d1cf-42b4-b131-1eaaf0b5cad5
[12:00:31] [luckperms-worker-51/INFO]: [LuckPerms] [Messaging] Sending user ping for 'valese' with id: ef216680-3d9d-4938-91c5-909542e748f6
[12:00:31] [pool-12-thread-1/INFO]: [LP] valese now inherits permissions from supporter in context global.
[12:00:31] [luckperms-worker-51/INFO]: [LuckPerms] [Messaging] Sending log with id: c3afb358-6e09-48d4-838c-7f639ba505dd
[12:00:31] [luckperms-worker-51/INFO]: [LuckPerms] [Messaging] Sending user ping for 'valese' with id: 44503794-2dd6-4413-adc0-8acc5f625b7f

The logs suggest the permissions should be there, but when we check the DB or check in-game, only the supporter perm is applied.

If we send the commands one at a time, the exact same commands using the same HTTP push mechanism, but send them one at a time with a few seconds between them, then they all apply correctly, so it appears that sending them with no delay between isn't being handled by LP?

commented

Though that has the downside, that commands ran too quickly will get lost.

Definitely not intended

commented

Thanks for confirming @lucko - if you want any info about what we're doing to generate the commands, let me know.

commented

LP handles its commands async. Everything else would be insane. Though that has the downside, that commands ran too quickly will get lost.
If I remember correctly there was a rationale behind it why the commands don’t wait for eachother in the background. @lucko will have to answer that.

In the meantime if a fix is urgent, just wait. Or use the API.

commented

A fix for this would be great @lucko or perhaps a config toggle as it's causing quite the issues for our production environment, where we execute several commands at once via BuyCraft.

commented

Testing was done on build 4.3.109
Do let me know if you'd like this tested on the latest builds @lucko

commented

Hey, I've been unable to reproduce this so far using the latest dev build of LP.

Which version were you testing with?

commented

Yes please - not sure what would've fixed it, but I haven't been able to reproduce despite testing various different approaches.

My test code is:

var console = server.getConsoleSender();

function dispatchCommand(command) {
	server.dispatchCommand(console, 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");
[16:29:05 INFO]: Done (3.867s)! For help, type "help"
[16:29:05 INFO]: Timings Reset
[16:29:09 INFO]: [helper-js] [LOADER] Reloaded script: lptest.js
> lptest
[16:29:11 INFO]: [LP] Set test-0 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-1 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-2 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-3 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-4 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-5 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-6 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-7 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-8 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-9 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-10 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-11 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-12 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-13 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-14 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-15 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-16 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-17 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-18 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-19 to true for luck in context global.
[16:29:11 INFO]: [LP] Set test-20 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-21 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-22 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-23 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-24 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-25 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-26 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-27 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-28 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-29 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-30 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-31 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-32 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-33 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-34 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-35 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-36 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-37 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-38 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-39 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-40 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-41 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-42 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-43 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-44 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-45 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-46 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-47 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-48 to true for luck in context global.
[16:29:12 INFO]: [LP] Set test-49 to true for luck in context global.
> lp user luck permission info
[16:29:17 INFO]: [LP] luck's Permissions:  (page 1 of 3 - 50 entries)
[16:29:17 INFO]: > test-0 (true)
[16:29:17 INFO]: > test-1 (true)
[16:29:17 INFO]: > test-10 (true)
[16:29:17 INFO]: > test-11 (true)
[16:29:17 INFO]: > test-12 (true)
[16:29:17 INFO]: > test-13 (true)
[16:29:17 INFO]: > test-14 (true)
[16:29:17 INFO]: > test-15 (true)
[16:29:17 INFO]: > test-16 (true)
[16:29:17 INFO]: > test-17 (true)
[16:29:17 INFO]: > test-18 (true)
[16:29:17 INFO]: > test-19 (true)
[16:29:17 INFO]: > test-2 (true)
[16:29:17 INFO]: > test-20 (true)
[16:29:17 INFO]: > test-21 (true)
[16:29:17 INFO]: > test-22 (true)
[16:29:17 INFO]: > test-23 (true)
[16:29:17 INFO]: > test-24 (true)
[16:29:17 INFO]: > test-25 (true)
>

I've tested:

  • With the target player online
  • With the target player offline
  • With groups

It's not possible to (easily) test executing the commands concurrently, as Spigot/Paper blocks async command execution. I assume Buycraft isn't doing this anyway.

Some info about how the commands are being generated / dispatched would be useful though @liam-wiltshire - I'm only really assuming they're being called from the server thread?

commented

https://github.com/BuycraftPlugin/BuycraftX/
You can look at src of their plugin here

commented

@lucko @liam-wiltshire

This is absolutely 100% still a problem.
BuyCraft push commands simply do not work with LuckPerms.
Disabling push commands returns everything to perfection.

Latest test environment:
PaperSpigot: Build 624
LuckPerms: Build 4.4.16
BuyCraft: Latest as of tebexio/BuycraftX@8b38fe5

commented

@liam-wiltshire Any way you could possibly set me up with a way to test the push commands function?