Server Implementation
Paper
Server Version
1.21.4
Describe the bug
getOrAddAttachment shouldn't add attachment to attachments hashmap if player is offline, because otherwise it leaks memory.
|
public PermissionAttachment getOrAddAttachment(@Nullable final Player p) { |
This bug happens in WorldGuard, https://github.com/EngineHub/WorldGuard/blob/ab48a6623722ac8ce34172eed13b8319444a61da/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java#L158
where recipient can possibly be a player instance that is offline. This happens because AsyncPlayerChatEvent could be delayed and later executed with player that is offline (see PaperMC discord, https://discord.com/channels/289587909051416579/555462289851940864/1365615050429304955)
I've attached stacktrace where it happens.
To Reproduce
Register onPlayerQuit event, call getOrAddAttachment after few seconds for the player that left. The player will stay in hashmap forever leaking memory.
Expected behaviour
Don't save player in hashmap if is offline
Screenshots / Videos
No response
Error log (if applicable)
https://gist.github.com/MsMaciek123/e56f5548f391b0fb0ce85fdeeaeebab4
Fawe Debugpaste
n/a
Fawe Version
FastAsyncWorldEdit version 2.13.1-SNAPSHOT
Checklist
Anything else?
FAWE doesn't seem to ever be calling getOrAddAttachment for player that is offline, and I was unsure whether to report it to FAWE or WG, but was told to report it here.
Server Implementation
Paper
Server Version
1.21.4
Describe the bug
getOrAddAttachment shouldn't add attachment to attachments hashmap if player is offline, because otherwise it leaks memory.
FastAsyncWorldEdit/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/BukkitPermissionAttachmentManager.java
Line 22 in f137a11
This bug happens in WorldGuard, https://github.com/EngineHub/WorldGuard/blob/ab48a6623722ac8ce34172eed13b8319444a61da/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java#L158
where recipient can possibly be a player instance that is offline. This happens because AsyncPlayerChatEvent could be delayed and later executed with player that is offline (see PaperMC discord, https://discord.com/channels/289587909051416579/555462289851940864/1365615050429304955)
I've attached stacktrace where it happens.
To Reproduce
Register onPlayerQuit event, call getOrAddAttachment after few seconds for the player that left. The player will stay in hashmap forever leaking memory.
Expected behaviour
Don't save player in hashmap if is offline
Screenshots / Videos
No response
Error log (if applicable)
https://gist.github.com/MsMaciek123/e56f5548f391b0fb0ce85fdeeaeebab4
Fawe Debugpaste
n/a
Fawe Version
FastAsyncWorldEdit version 2.13.1-SNAPSHOT
Checklist
Anything else?
FAWE doesn't seem to ever be calling getOrAddAttachment for player that is offline, and I was unsure whether to report it to FAWE or WG, but was told to report it here.