-
-
Notifications
You must be signed in to change notification settings - Fork 82
Synchronization fixes. #1624
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
devw4r
wants to merge
21
commits into
The-Alpha-Project:master
Choose a base branch
from
devw4r:G
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Synchronization fixes. #1624
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Re-add thread synchronization to UpdatePacketFactory and ObjectManager. This commit re-introduces RLock-based synchronization for the update field mechanism, effectively reverting the removal of locks that occurred in commit #f392c50f The synchronization is required to prevent race conditions that the Python Global Interpreter Lock (GIL) does not cover: 1. Atomicity of 64-bit updates: These are split into two 32-bit operations. Without locks, a thread generating a packet could capture a corrupted state where only half of a 64-bit value is updated. 2. Consistent Snapshots: When generating update packets, the iteration over bitmasks and field values must be atomic relative to writers to ensure the client receives a consistent "point-in-time" state of the object. 3. Atomic "Check-then-Set": Logical sequences that check if a field should be updated before applying the change are not atomic at the bytecode level and require protection to prevent interleaved updates from different threads (e.g., Network, Player Tick, and Creature Tick). These changes fix the bug where multiple observers would occasionally see inconsistent state (such as a creature appearing alive for one player and dead for another) due to shared-state mutation or partial updates during packet generation.
…roundings (Creatures / Gos, etc)
…ker for deterministic execution and improved synchronization.
- Fix case were auras like Devotion Auras were wrongfully removed from the player upon killing something. - Fix case in which players received duplicate update packets upon spawning from teleport. - Make sure we always pass the proper value type to UpdatePacketFactory, this fixes some issues in which some fields were always returning should_update as TRUE, spamming clients with updates every tick. - Fix Resurrection Sickness causing health regeneration to kill the player. - Make sure unit.die() is called if necessary where set_health() calls are made.
…ess. - Enhance process initialization to prevent hanging in the event of a segmentation fault.
- Loot - Both loops should check if they need to remove quest items.
- Avoid duplicate selection for pool entries.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re-add thread synchronization to UpdatePacketFactory and ObjectManager.
This commit re-introduces RLock-based synchronization for the update field mechanism, effectively reverting the removal of locks that occurred in commit #f392c50f
The synchronization is required to prevent race conditions that the Python Global Interpreter Lock (GIL) does not cover:
Atomicity of 64-bit updates: These are split into two 32-bit operations. Without locks, a thread generating a packet could capture a corrupted state where only half of a 64-bit value is updated.
Consistent Snapshots: When generating update packets, the iteration over bitmasks and field values must be atomic relative to writers to ensure the client receives a consistent "point-in-time" state of the object.
Atomic "Check-then-Set": Logical sequences that check if a field should be updated before applying the change are not atomic at the bytecode level and require protection to prevent interleaved updates from different threads (e.g., Network handlers, Player tick, Creature tick or Go's tick).
These changes fix bugs where multiple observers would occasionally see inconsistent state (such as a creature appearing alive for one player and dead for another) due to shared-state mutation or partial updates during packet generation.