Fix thread-safety issues in concurrent code paths#2054
Conversation
|
Ok I didn't know it was going to make a pr... |
Co-authored-by: kevinthegreat1 <92656833+kevinthegreat1@users.noreply.github.com>
Co-authored-by: kevinthegreat1 <92656833+kevinthegreat1@users.noreply.github.com>
|
Don't make just random code thread-safe. Only check for thread safety in actual concurrent code that is being accessed by multiple threads. |
kevinthegreat1
left a comment
There was a problem hiding this comment.
Don't make just random code thread-safe. Only check for thread safety in actual concurrent code that is being accessed by multiple threads.
…ently Co-authored-by: kevinthegreat1 <92656833+kevinthegreat1@users.noreply.github.com>
Reverted changes to code without actual concurrent access. Kept only:
Reverted DiscordRPCManager, SecretsTracker, and SkyblockerWebSocket (events/calls are sequential, no real concurrency). Commit: 11a3eaa |
kevinthegreat1
left a comment
There was a problem hiding this comment.
Fix the merge conflicts. Don't migrate backpack preview to an atomic array, keep it as a normal array. Only fix accessing the array twice in certain cases (null checks).
# Conflicts: # src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/BackpackPreview.java # src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java
3482952 to
5a98582
Compare
kevinthegreat1
left a comment
There was a problem hiding this comment.
Welp I had to do it myself.
Fixes thread-safety issues in classes where async tasks write to shared state that is read by the main/render thread.
Changes
hypixelProfile,playerProfile,entity, etc.) for visibility of async writes to render threadstoragesto guarantee visibility and atomic operations across threadsitemsImported/filesImportedflags for visibility across async loading and synchronous readsScope
Only code with verified concurrent access has been modified - specifically cases where:
Code using CompletableFutures but without actual concurrent access to shared mutable state (e.g., sequential event handlers, serialized task queues) has not been modified.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.