Skip to content

Fixes async help unregister async #7962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev/patch
Choose a base branch
from

Conversation

TheLimeGlass
Copy link
Contributor

@TheLimeGlass TheLimeGlass commented Jun 20, 2025

Problem

Reloading scripts asynchronously that contain commands that have already registered their commands.

I use config.sk setting script loader thread size: 1 so this could be the culprit.

Caused by: java.util.ConcurrentModificationException
    at java.base/java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1521)
    at java.base/java.util.TreeMap$ValueIterator.next(TreeMap.java:1566)
    at java.base/java.util.AbstractCollection.removeAll(AbstractCollection.java:370)
    at Skript.jar//ch.njol.skript.command.ScriptCommand.unregisterHelp(ScriptCommand.java:462)
    at Skript.jar//ch.njol.skript.command.Commands.unregisterCommand(Commands.java:267)
    at Skript.jar//ch.njol.skript.structures.StructCommand.unload(StructCommand.java:313)
    at Skript.jar//ch.njol.skript.ScriptLoader.unloadScripts(ScriptLoader.java:850)
    at Skript.jar//ch.njol.skript.ScriptLoader.reloadScripts(ScriptLoader.java:909)
    at Skript.jar//ch.njol.skript.ScriptLoader.reloadScript(ScriptLoader.java:898)

Skript 2.11.2
Paper 1.21.5

Solution

Unregister help commands on the main thread. Bukkit's help system isn't thread-safe.

@TheLimeGlass TheLimeGlass requested review from sovdeeth and a team as code owners June 20, 2025 17:45
@TheLimeGlass TheLimeGlass requested review from cheeezburga and removed request for a team June 20, 2025 17:45
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jun 20, 2025
@TheLimeGlass TheLimeGlass marked this pull request as draft June 20, 2025 17:49
@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jun 20, 2025
@TheLimeGlass TheLimeGlass marked this pull request as ready for review June 20, 2025 17:51
@TheLimeGlass TheLimeGlass requested a review from sovdeeth June 20, 2025 17:54
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jun 20, 2025
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine but I'd like pickle to review too

@skriptlang-automation skriptlang-automation bot added patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. and removed needs reviews A PR that needs additional reviews labels Jun 20, 2025
@sovdeeth sovdeeth requested a review from APickledWalrus June 20, 2025 18:31
@sovdeeth sovdeeth added the don't merge me !! For pull requests that should not be merged due to some outstanding dispute, conflict or dependency. label Jun 20, 2025
@skriptlang-automation skriptlang-automation bot removed the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
don't merge me !! For pull requests that should not be merged due to some outstanding dispute, conflict or dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants