Skip to content

Strange behaviour in buildkitd entrypoint #4307

@mcheshkov

Description

@mcheshkov

What went wrong?

After successfully starting buildkitd entrypoint starts trying to kill every other process with SIGKILL, which does not do anything with usual image, but can be fatal if there's other processes right next to builkdkitd

What should have happened?

Entrypoint should have waited for buildkitd to exit.

What earthly version?

I hit that with earthly/satellite:v0.8.15

Buildkit Logs

No response

Other Helpful Information

I think this bug was introduced here
1406b9f

Before

    if ! kill -0 "$execpid" >/dev/null 2>&1; then
        echo "Error: buildkit process has exited"
        exit 1
    fi

If sending signal zero to $execpid fails, then it logs error and exit with 1

After

    if ! kill -0 "$execpid" >/dev/null 2>&1; then
        wait "$execpid"
        code="$?"
        if [ "$code" != "0" ]; then
            echo "Error: buildkit process has exited with code $code"
        fi
        exit "$code"
    fi

If sending signal zero to $execpid fails, then it start waiting for it to exit!
And after 1f97c43, if sending signal zero did not fail, it will fall through to sending SIGKILL to every child of PID 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions