fix(unikontainers): add default hook timeout to prevent Exec() hang#701
Open
Chennamma-Hotkar wants to merge 1 commit into
Open
fix(unikontainers): add default hook timeout to prevent Exec() hang#701Chennamma-Hotkar wants to merge 1 commit into
Chennamma-Hotkar wants to merge 1 commit into
Conversation
Add DefaultHookTimeoutSec field to UruncConfig (default 30s) and use it as fallback in executeHook() when hook.Timeout is not set. Prevents container startup hang when a hook has no timeout defined. Fixes: urunc-dev#700 Signed-off-by: Chennamma-Hotkar <channuhotkar@gmail.com>
✅ Deploy Preview for urunc canceled.
|
Contributor
|
Hello @Chennamma-Hotkar please read the contribution guide |
Author
|
Hi @cmainas, I have edited the PR description to match the contribution guide template. I have added files changed how it was tested LLM disclosure and a checklist. Let me know if there is anything else that needs to be fixed. |
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
In pkg/unikontainers/utils.go executeHook() sets a contexts timeout only when hook.Timeout is set, per the OCI spec. That spec indicates that it is an optional field, *int and omitempty. If it is not set, executeHook() defaults to context.Background() which can never be cancelled. If a hook hangs indefinitely then executeHook() will never return, thereby hanging wg.Wait() called from executeHooksConcurrently(), which means errChan will never be closed and Exec() can hang forever and never log an error or warning. The comment on line 312 indicated that in the 'otherwise' case, we should use global config timeout, but this was not implemented in UruncConfig. Take the config value from UruncConfig and if the OCI spec hook has no timeout set, use it. Add a field to UruncConfig to indicate the default hook timeout in seconds. Add it to urunc.json.orig, set it to 30s.
Files changed:
pkg/unikontainers/urunc_config.go— addedDefaultHookTimeoutSecpkg/unikontainers/utils.go— use default timeout as fallbackpkg/unikontainers/unikontainers.go— pass default timeout to callerspkg/unikontainers/urunc_config_test.go— assert default value is 30sRelated issues
How was this tested?
All existing unit tests pass (
make unittest). Build passes (make). Added assertion forDefaultHookTimeoutSecinTestDefaultConfigs.LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).