-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[script] Fix script.wait hanging when triggered from on_boot #12102
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
Conversation
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#12102
components: [script]
refresh: 1h(Added by the PR bot) |
Memory Impact AnalysisComponents:
📊 Component Memory Breakdown
🔍 Symbol-Level Changes (click to expand)Changed Symbols
This analysis runs automatically when components change. Memory usage is measured from a representative test configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #12102 +/- ##
==========================================
+ Coverage 72.47% 72.50% +0.02%
==========================================
Files 53 53
Lines 11159 11159
Branches 1513 1513
==========================================
+ Hits 8088 8091 +3
+ Misses 2676 2674 -2
+ Partials 395 394 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a race condition bug in ScriptWaitAction where script.wait would hang forever when triggered from on_boot. The issue is identical to the one previously fixed for WaitUntilAction in PR #11869.
Key Changes:
- Added conditional check in
ScriptWaitAction::setup()to only disable the loop ifnum_running_is 0 - Added comprehensive integration test to verify the fix works correctly
- Test reproduces the exact scenario where the bug manifests (on_boot triggering script.wait at the same priority level)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| esphome/components/script/script.h | Fixed race condition in ScriptWaitAction::setup() by checking num_running_ before disabling loop |
| tests/integration/test_script_wait_on_boot.py | Added comprehensive integration test verifying script.wait works correctly when triggered from on_boot |
| tests/integration/fixtures/script_wait_on_boot.yaml | Test fixture defining two scripts with delays to reproduce the hanging bug scenario |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|
thanks |
What does this implement/fix?
Applies the same fix from #11869 to
ScriptWaitAction.PR #11869 fixed
WaitUntilActionhanging when triggered fromon_boot, but the identical bug existed inScriptWaitAction. The root cause is the same:setup()unconditionally disabled the loop, even ifplay_complex()had already been called and enabled it.The fix adds the same conditional check to only disable the loop in
setup()ifnum_running_is 0.Types of changes
Related issue or feature (if applicable):
Pull request in esphome-docs with documentation (if applicable):
Test Environment
Example entry for
config.yaml:Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: