Open A248 opened 4 years ago
Hi, how about making a PR? I made a fork and if you like we can implement and test this changes on it 👍
I realised Formatter#format does not need to be thread safe.
Hi, i commented on Discord this but i comment here too; Maybe you can make the methods synchronized instead of adding a synchronized block.
It seems to me a lot of parts of the proxy are unsychronised where I would think mutual exclusion would be required.
Plugin#getExecutorService. Although deprecated, if called multiple times, it's possible multiple ExecutorServices could be instantiated. Seeing as this method is used by BungeeScheduler, this could cause a resource leak should plugins use scheduling methods concurrently.
BungeeSecurityManager: The HashSet
seen
is unsynchronised, but could be accessed and mutated by multiple threads.PluginManager and everything about it. It has multiple non-thread safe collections in its fields. Though it's unlikely plugins would register commands or listeners asynchronously, this is not something I think should be ignored.
ConciseFormatter uses SimpleDateFormat, which is not thread safe, in what appears to be an unsynchronised manner. I am not aware of any synchronisation performed byFileHandler#publish/StreamHandler#publish, which uses the Formatter, is already synchronized.java.util.logging.Formatter
. Plugins logging concurrently is definitely a possibility. Though the repercussions of this might only be an infrequent oddly-formatted date, better to follow best practices and abide by thread safe access. Sometimes not doing so incurs unexpected consequences.Although some of these situations may be rather minor, I would presume it's in BungeeCord's best interest to maintain integrity at all times, even where small things such as registering commands and listeners or executing tasks are concerned.