LuckPerms

LuckPerms

41.4k Downloads

Non-threadsafe group data saving using plaintext formats (JSON/YAML)

PolyacovYury opened this issue ยท 2 comments

commented

Description

The issue presents itself with GriefDefender that uses LuckPerms as data storage.
Basically, every time I run a /gdreload or re-start the server - the amount of flags stored in one of the groups - griefdefender_definition - changes drastically. It should contain around 100 flags, but the amount jumps from single- to double-digits. It looks like GD clears that group and adds flags to it one-by-one asynchronously, which LP doesn't like and sometimes even breaks the file syntax.
The erroneous behaviour was observed with json and yaml storage formats.

Reproduction steps

My full investigation and reproduction steps can be found starting from here: https://discord.com/channels/241667244927483904/690683905677983756/804016107857248307

Expected behaviour

Basically, LP data storage is expected to be threadsafe.

Environment details

  • Server type/version: SpongeForge running version 1.12.2 build RC4093
  • LuckPerms version: LuckPerms-Sponge-5.2.78

Any other relevant details

commented
    thread {
        # The number of threads to use for GD's executor. (Default: 1)
        executor-threads=2
    }

This value in GD's global.conf has to be more than 1, otherwise GD does everything in a non-parallel way, which obviously results in single-threaded processing without any race conditions.

This config value will be removed in GD 1.6.0, partly because of this issue.

commented

Should be fixed by the above commit, thanks for reporting :)