Repository navigation
exec:fix exec log grow to burst - #11862
ningmingxiao wants to merge 1 commit into
Conversation
|
Hi @ningmingxiao. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
e9dce90 to
64094b0
Compare
7972aa1 to
3f71cfe
Compare
fb38dd9 to
4b731ca
Compare
4b731ca to
fea419e
Compare
fea419e to
c761c46
Compare
5907dfb to
e8ca85f
Compare
e8ca85f to
e4cd1dd
Compare
e4cd1dd to
9970f3e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
cmd/containerd-shim-runc-v2/process/exec.go:220
Execnow overrides runc's--logviaopts.LogFile, but on failure the shim still callsruntimeError, which only reads fromp.runtime.Log(the sharedlog.json). This means exec failures will likely lose the detailed OCI runtime error (or potentially report an unrelated prior error), reducing debuggability.
opts := &runc.ExecOpts{
PidFile: pidFile.Path(),
Detach: true,
LogFile: filepath.Join(filepath.Dir(e.parent.runtime.Log), fmt.Sprintf("%s-exec.log", e.id)),
}
if pio != nil {
opts.IO = pio.IO()
}
if socket != nil {
opts.ConsoleSocket = socket
}
defer os.Remove(opts.LogFile)
if err := e.parent.runtime.Exec(ctx, e.parent.id, e.spec, opts); err != nil {
close(e.waitBlock)
return e.parent.runtimeError(err, "OCI runtime exec failed")
}
|
ping @samuelkarp can you take a look ? |
|
ping @samuelkarp |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
integration/container_exec_test.go:125
- This test derives the task log directory from
client.GetDefaultState()(which is hard-coded to/run/containerd-teston Unix). That can break when the integration harness points--cri-endpointat a containerd instance using a different--statedirectory (e.g. viaCONTAINERD_STATEoverrides), because the log.json path will be computed incorrectly.
Consider deriving the state directory from the actual endpoint used by the test (e.g. filepath.Dir(containerdEndpoint) for unix sockets) and dropping the dependency on integration/client here.
execLogDir := getLogDirPath(client.GetDefaultState(), "v2", "k8s.io", cn)
logJSON := filepath.Join(execLogDir, "log.json")
before, err := os.Stat(logJSON)
require.NoError(t, err)
| if err != nil { | ||
| return "", err | ||
| } | ||
| return cfg.DefaultRuntimeName, nil |
There was a problem hiding this comment.
We should be looking for the actual shim io.containerd.runc.v2 not runc or crun here.
Something like:
// runtimeTypeForHandler returns the containerd runtime type that the CRI plugin
// uses for the given runtime handler. An empty handler resolves to the
// configured default.
func runtimeTypeForHandler(t *testing.T, handler string) string {
resp, err := runtimeService.Status()
require.NoError(t, err)
var cfg criconfig.Config
require.NoError(t, json.Unmarshal([]byte(resp.GetInfo()["config"]), &cfg))
if handler == "" {
handler = cfg.DefaultRuntimeName
}
r, ok := cfg.Runtimes[handler]
require.Truef(t, ok, "runtime handler %q is not configured", handler)
return r.Type
}
func TestVerifyRuntimeTypeForHandler(t *testing.T) {
rt := runtimeTypeForHandler(t, *runtimeHandler)
t.Logf("handler %q resolves to runtime type %q", *runtimeHandler, rt)
require.Equal(t, plugins.RuntimeRuncV2, rt)
}or
func TestVerifyRuntimeInfoName(t *testing.T) {
info, err := containerdClient.RuntimeInfo(context.Background(), plugins.RuntimeRuncV2, nil)
require.NoError(t, err)
t.Logf("RuntimeInfo name=%q version=%+v", info.Name, info.Version)
require.Equal(t, plugins.RuntimeRuncV2, info.Name)
}(Claude Code Opus 5 wrote these)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
integration/container_exec_test.go:130
- This test reads
log.jsonfromclient.GetDefaultState()("/run/containerd-test" on Linux), but the integration test suite connects to an existing containerd via-cri-endpoint(default "/run/containerd/containerd.sock"), so the actual state dir is typically different (e.g. "/run/containerd"). Use the CRI config’sstateDirfromruntimeService.Status()to locate the task directory, otherwise this test will fail or silently validate the wrong file.
t.Logf("Exec in container %s", cn)
execLogDir := getLogDirPath(client.GetDefaultState(), "v2", "k8s.io", cn)
logJSON := filepath.Join(execLogDir, "log.json")
before, err := os.Stat(logJSON)
Signed-off-by: ningmingxiao <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
integration/client/client_windows.go:48
- Use of os.Getenv("programfiles") is inconsistent with other Windows paths in this repo (which use "ProgramFiles") and can produce a relative path if the variable is empty. Consider reading "ProgramFiles" first and falling back if needed.
func GetDefaultState() string {
return filepath.Join(os.Getenv("programfiles"), "containerd", "state-test")
}
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
fix: #8972
@mikebrow @fuweid @mxpv @dmcgowan