Time out crashing with LuckPerms in script
Coolkc456 opened this issue ยท 3 comments
Minecraft Version
1.20.1
KubeJS Version
fabric-2001.6.5-build.16
Rhino Version
fabric-2001.2.3-build.6
Architectury Version
9.2.14-fabric
Forge/Fabric Version
Fabric 0.16.10
Describe your issue
I have a script that uses LuckPerms to check if a player has a permission and if so, runs a command. It was working for several days but it now suddenly crashes the server. I have tested it with players who do and do not have the permission and it crashed regardless.
Here is my crash log: https://mclo.gs/VuduoQ9
Here is my regular log that shows me logging in and then timing out and the server crashing: https://mclo.gs/ZHYK2gV
My script will work at first, but eventually it will begin resulting in the error I have documented in the logs. I'm not sure what triggers it to start breaking. KubeJS loads with no errors. LuckPerms works fine by itself or in command blocks. It's only when combined with KubeJS that results in issues.
https://mclo.gs/QJvsN1Z
This is caused by how KJS handles threading, or rather how it doesn't. All scripts in KJS lock onto a main lock and only one bit of a script can execute at a time. This can occasionally cause issues when two scripts try to execute in parallel and one of them depends on the other finishing (here specifically a chat event waiting on permissions to be grabbed from the main thread while the main thread waits for the lock to be given back from the chat event for another (probably something.tick, i cant tell though because you don't have full stack watchdog installed) handler.
A solution to this one on the KJS side will be to make the chat event execute on the main thread, or you can do that with a server tick event listening for entries to be added to a synchronous list from a chat handler.
Thank you for that insight! Does this issue happen even if it isn't using LuckPerms commands? I've found out that it's happening on these scripts as well, even though these scripts just run tellraw commands.
https://mclo.gs/JfWm3ui