fix(hooks): prevent panic from loop variable capture in concurrent execution#445
Open
ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
Open
fix(hooks): prevent panic from loop variable capture in concurrent execution#445ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
Conversation
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
@cmainas please have a look |
0854c8d to
0957257
Compare
Contributor
|
Hello @ishaanxgupta , the changes look good, but a rebase over the main branch is required. |
0957257 to
af3ce32
Compare
Contributor
Author
|
@cmainas done |
Contributor
|
I see another user pushed here @hemang1404 . I do not know how that happened but:
|
Fix panic from accessing hooks[i] in async execution after loop. Use captured parameter h instead. Fixes: urunc-dev#418 Co-authored-by: hemang1404 <[email protected]> Signed-off-by: Ishaan Gupta <[email protected]>
af3ce32 to
2c8a260
Compare
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.
Description
This PR fixes a loop variable capture bug in executeHooksConcurrently() that could cause panics and incorrect logging when hooks are executed concurrently.
Panic Prevention: Eliminates panic when i == len(hooks) after loop completes
Related issues
How was this tested?
Confirmed the captured parameter h is used consistently in the goroutine
Checked that no other instances of this pattern exist in the function
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).collaborated with @hemang1404