LuckPerms compatibility audit: fix event subscription lifecycle, coalesce resyncs#1
Merged
Merged
Conversation
- Close the UserDataRecalculateEvent subscription on ServerStoppedEvent and re-subscribe on the next server start, instead of leaking the subscription (and a stale MinecraftServer reference) across server lifecycles in the same JVM, which also silently broke live command-tree resync after an embedded restart. - Coalesce LP-triggered command-tree resyncs per player so a burst of recalculation events sends a single ClientboundCommandsPacket. - Downgrade the per-event recalculation log from INFO to DEBUG. - Add docs/LUCKPERMS_COMPATIBILITY_AUDIT.md covering every LP touchpoint, including documented-but-unchanged findings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full audit of every LuckPerms touchpoint in the mod (backend selection, runtime checks, event integration, version gating, mod metadata, tests, docs). Two concrete bugs are fixed in this PR; five additional findings are documented in
docs/LUCKPERMS_COMPATIBILITY_AUDIT.mdwithout behaviour changes, since they reflect deliberate 1.0.3 policy or low-risk inconsistencies.Fixed
HIGH - LP event subscription leaked across server lifecycles
LuckPermsService.initServerHooks()subscribed toUserDataRecalculateEventwithout keeping theEventSubscription, guarded by a one-wayhooksReadyflag. After a server stop + start in the same JVM (integrated server opening another world, embedded restart):MinecraftServer(memory leak of the whole server graph);hooksReadystayedtrue, so the new server never re-subscribed - live command-tree resync silently stopped working until JVM restart.The subscription is now stored, closed on
ServerStoppedEvent(closeServerHooks()), and re-created on the nextServerStartedEvent.MEDIUM - Resync storm on UserDataRecalculateEvent
LP fires this event in bursts for the same user (login, group-inheritance recalculation, messaging sync, web-editor apply). Each event triggered one full
ClientboundCommandsPacketre-send plus an INFO log line. Resyncs are now coalesced per player (one packet per burst) and the per-event log is DEBUG.Documented, intentionally not changed (see audit doc)
degradedflip on the first LP exception (documented invariant) - one transient hiccup disables the LP backend until restart, default fallbackdeny. A re-probe on/customperm reloadis suggested as follow-up.5.4.150-SNAPSHOT,5.5.0-beta) regardless of numeric value - documented as deliberate.neoforge.mods.tomldeclares[5.4,)while code enforces5.4.150+- LP below 5.4 hard-fails at the loader instead of the graceful fallback./customperm testcan show DENIED for an op.Validation
./gradlew compileJava test- build and full pure-Java unit suite pass.compileOnly, the changed code paths only run with LP present); the two fixes require a dev server with the LP jar inrun/mods/per the README manual-validation procedure.