Skip to content

bug: hooks without timeout cause Exec() to hang indefinitely #700

@Chennamma-Hotkar

Description

@Chennamma-Hotkar

Description

In pkg/unikontainers/utils.go, executeHook() only sets a context
timeout when hook.Timeout is explicitly set in the OCI spec:

if hook.Timeout != nil && *hook.Timeout > 0 {
    ctx, cancel = context.WithTimeout(...)
}

The OCI spec defines Timeout as optional (*int, omitempty).
When absent, context.Background() is used — which never cancels.

A hook process that hangs forever will block executeHooksConcurrently()
because wg.Wait() never returns, errChan never closes, and
for err := range errChan blocks forever. The container never starts
and no error or warning is logged.

The comment on line 312 says "otherwise use global config timeout"
but no global timeout is implemented in UruncConfig.

System info

  • Urunc version: 0.7.0-154fc9e
  • Arch: x86_64
  • VMM: any
  • Unikernel: any

Steps to reproduce

  1. Define a container with a hook that has no timeout field set
  2. Make the hook process hang indefinitely (e.g. sleep infinity)
  3. Observe urunc never completes Exec() with no error logged

Note

This issue was identified during a code review of the hook execution
path. The code path has been manually verified by the contributor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions