-
Notifications
You must be signed in to change notification settings - Fork 3.8k
*: add runc-fp as runc wrapper to inject failpoint #9121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6ae7ab1 to
a6a7558
Compare
| t.Skip("skip it when using crun") | ||
| } | ||
|
|
||
| t.Skip("Wait for #9104") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe take this out so we can see it fail, and then rebase after #9104?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Updated!
a6a7558 to
b6db7c7
Compare
|
|
||
| type invoker func(context.Context) error | ||
|
|
||
| type invokerInterceptor func(context.Context, invoker) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be useful to be able to selectively invoke an interceptor func based on a specific runc command? e.g. one may only want to intercept the runc exec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the invokerInterceptor can choose to do that already by inspecting os.Args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that's true. LGTM then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@henry118 I don't have good idea to inject failpoint by some json settings (like shim-api-level )
| if err := fp.Evaluate(); err != nil { |
So, if we have to inject failpoint during runc call, we need to add new profile code to support the specific scenario. It's not flexible but just works. Any inputs are welcomed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fuweid My original idea was having flexible interceptor behaviors per different subcommand of runc. So I think Sam's suggestion was valid, since a specific Interceptor's implementation could inspect or.Args to find out the runc subcommand, and choose to simply return after executing default invoker or continue to perform other actions.
I did a local testing by modifying the interceptor like this:
func issue9103KillInitAfterCreate(ctx context.Context, method invoker) error {
return method(ctx)
}
But the test still failed:
=== RUN TestIssue9103
log_hook.go:47: time="2023-09-21T16:42:02.717750203Z" level=debug msg="remote introspection plugin filters" func="introspection.(*introspectionRemote).Plugins" file="/home/ubuntu/go/src/github.com/pr/containerd/services/introspection/introspection.go:46" filters="[type==io.containerd.snapshotter.v1, id==overlayfs]" testcase=TestIssue9103
container_linux_test.go:1470:
Error Trace: /home/ubuntu/go/src/github.com/pr/containerd/integration/client/container_linux_test.go:1470
Error: Not equal:
expected: "created"
actual : "stopped"
Diff:
--- Expected
+++ Actual
@@ -1,2 +1,2 @@
-(containerd.ProcessStatus) (len=7) "created"
+(containerd.ProcessStatus) (len=7) "stopped"
Test: TestIssue9103
--- FAIL: TestIssue9103 (0.18s)
FAIL
I think there are 2 issues in this test case:
- Since we never started the task, the expected task status should be "created";
- The "expected" & "actual" values are confusing. I think they should be swapped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @henry118 For the first one, the #9104 reporter run into a issue that the runc-init process has been killed after runc-create returned successfully. So the process should be stopped. The failpoint is used to simulate the weird case. For the normal case, we should not use runc-fp. The case is expecting stopped status. However, your change is just creating the normal runc-init process. That's why it fails.
For the second one, yes. I will swap them.
b6db7c7 to
a05d54f
Compare
Signed-off-by: Wei Fu <fuweid89@gmail.com>
a05d54f to
e4a00a9
Compare
Build for #9104