Skip to content
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

Thread safe PluginManager #3771

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BoomEaro
Copy link
Contributor

@BoomEaro BoomEaro commented Jan 7, 2025

This pull request adds a ReadWriteLock lock to methods modifying the commandMap and listenersByPlugin collections, ensuring thread safe for the PluginManager.

This is necessary because some plugins may register their commands or listeners asynchronously or in parallel while BungeeCord is still loading plugins or when for example a plugin registers its commands dynamically in some specific scenarios.

@caoli5288
Copy link
Contributor

I don't think frameworks should pay the price for unconventional usage by users

@Janmm14
Copy link
Contributor

Janmm14 commented Jan 14, 2025

I don't think frameworks should pay the price for unconventional usage by users

I do not see additonal locks in hot paths, so the price to pay is small.

@Outfluencer
Copy link
Collaborator

I don't think frameworks should pay the price for unconventional usage by users

I do not see additonal locks in hot paths, so the price to pay is small.

I agree, but the blocking time would be even less if command and event related stuff would have seperate locks as they dont need to be synchronized with each other

@md-5
Copy link
Member

md-5 commented Jan 22, 2025

Agree they should be separate locks, otherwise no issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants