Fix Incorrect Variable Change Queue Processing#8182
Merged
Absolutionism merged 1 commit intodev/patchfrom Sep 17, 2025
Merged
Conversation
sovdeeth
approved these changes
Sep 10, 2025
Efnilite
approved these changes
Sep 10, 2025
sovdeeth
added a commit
that referenced
this pull request
Oct 1, 2025
* Swap reset and delete errors in EffChange (#8177) swap reset and delete errors * Fix improper grammar in update block syntax (#8072) Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Fix Incorrect Variable Change Queue Processing (#8182) Fix incorrect change processing order * Change registerExpression() parameter name (#8180) change parameter name * Move EvtRealTime to main thread (#8185) * Fix type-aware function parsing for functions with only optional arguments (#8189) Account for functions with all optional parameters * Properly parse exprsecs in function calls (#8199) modify section context when parsing functions * add runtime error when EffSort aborts due to null values. * catch runtime errors
erenkarakal
pushed a commit
to erenkarakal/Skript
that referenced
this pull request
Nov 26, 2025
) * Swap reset and delete errors in EffChange (SkriptLang#8177) swap reset and delete errors * Fix improper grammar in update block syntax (SkriptLang#8072) Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Fix Incorrect Variable Change Queue Processing (SkriptLang#8182) Fix incorrect change processing order * Change registerExpression() parameter name (SkriptLang#8180) change parameter name * Move EvtRealTime to main thread (SkriptLang#8185) * Fix type-aware function parsing for functions with only optional arguments (SkriptLang#8189) Account for functions with all optional parameters * Properly parse exprsecs in function calls (SkriptLang#8199) modify section context when parsing functions * add runtime error when EffSort aborts due to null values. * catch runtime errors
erenkarakal
pushed a commit
to erenkarakal/Skript
that referenced
this pull request
Nov 26, 2025
) * Swap reset and delete errors in EffChange (SkriptLang#8177) swap reset and delete errors * Fix improper grammar in update block syntax (SkriptLang#8072) Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Fix Incorrect Variable Change Queue Processing (SkriptLang#8182) Fix incorrect change processing order * Change registerExpression() parameter name (SkriptLang#8180) change parameter name * Move EvtRealTime to main thread (SkriptLang#8185) * Fix type-aware function parsing for functions with only optional arguments (SkriptLang#8189) Account for functions with all optional parameters * Properly parse exprsecs in function calls (SkriptLang#8199) modify section context when parsing functions * add runtime error when EffSort aborts due to null values. * catch runtime errors
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
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.
Problem
When variables are being changed across multiple threads, a lock is used to prevent concurrent modification. If a thread is unable to acquire the lock, it instead pushes its changes to a queue to avoid blocking the thread. This queue is processed the next time a thread is able to acquire the lock and make changes.
However, the process in which changes are applied has a dangerous flaw. Changes are supposed to be processed oldest to newest so that older changes do not override newer ones. The queue itself process changes in order, but the specific variable update that triggered the queue processing is processed before. This is a major mistake that can lead to the specific variable update being overridden.
This issue was discovered after a report on Discord of seemingly improper variable behavior. The user had some sort of async processes that were leading to the change queue being used. Consider the following scenario:
Variable's change implementation for SET takes the following action:{my_var::*}{my_var::*}to10 and 20The problem with the current implementation is that it's possible for
action 1to be delayed (pushed to the change queue) while foraction 2a lock is able to be acquired. This results inaction 2occurring and thenaction 1occurring, leading to the variable being deleted instead of set.Solution
The logic has been updated so that the change queue is processed (if changes are available) before the specific variable change.
Testing Completed
I had the user that reported this issue test the patch. They confirmed the issue was resolved.
Supporting Information
Completes: none
Related: Reported on Discord