Open ianlewis opened 4 years ago
@ianlewis I want to try this issue. But I don't know where to start because this issue is related to all sorts of codes in this project. And I'm not familiar to the details of gVisor but I know what this issue expects. Could you guide me in a bit?
@Yuya9786 It shouldn't be too involved. This is really just a placeholder issue to use "%w"
style formatting directives rather than "%v"
for errors when calling fmt.Errorf
. So rather than this:
return fmt.Errorf("some error: %v", err)
The code would look like this
return fmt.Errorf("some error: %w", err)
You can search for some places where fmt.Errorf
is used here: https://github.com/google/gvisor/search?q=fmt.Errorf
I got it. I'll fix all fmt.Errorf
s' "%v"
to "%w"
.
@Yuya9786 Excuse me, are you still working on this issue? If not, may I would like to take over this?
@ryo-yamaoka I've already done to fix and succeeded to build, but I couldn't succeed to test because of timeout. Maybe the cause is that my laptop specs are not good enough. Would you be willing to test instead of me?
@Yuya9786 I tried high spec machine, then succeeded to build and unit-tests
, and failed nogo-tests into make tests
.
The reason for the failure seems to be different (There appears to be no timeout log.), but the bazel logs disappeared and I couldn't see them...
Is it also nogo-tests that you failed?
SPEC of build environment
$ sudo make copy TARGETS=runsc DESTINATION=bin/
(omission middle part)
INFO: Analyzed target //runsc:runsc (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: Elapsed time: 0.417s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
INFO: Build completed successfully, 0 total actions
$ sudo make unit-tests
(omission middle part)
//pkg/tcpip/stack:stack_x_test PASSED in 0.1s
Stats over 8 runs: max = 0.1s, min = 0.1s, avg = 0.1s, dev = 0.0s
Executed 224 out of 224 tests: 224 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
INFO: Build completed successfully, 7754 total actions
INFO: Build Event Protocol files produced successfully.
INFO: Build completed successfully, 7754 total actions
$ sudo cat /root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/pkg/test/testutil/testutil_nogo/test.log
cat: /root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/pkg/test/testutil/testutil_nogo/test.log: No such file or directory
By the way, when I run make nogo-tests
I get a lot of errors like the following.
You may want to fix this first.
================================================================================
FAIL: //pkg/sentry/kernel/shm:shm_nogo (see /root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/pkg/sentry/kernel/shm/shm_nogo/test.log)
INFO: From Testing //pkg/sentry/kernel/shm:shm_nogo:
==================== Test output for //pkg/sentry/kernel/shm:shm_nogo:
printf: pkg/bpf/decoder.go:69:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:98:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:112:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:131:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:167:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:179:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:203:11: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:234:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
printf: pkg/bpf/decoder.go:247:10: fmt.Errorf format %w has arg inst of wrong type gvisor.dev/gvisor/pkg/abi/linux.BPFInstruction
================================================================================
@ryo-yamaoka Thank you for pointing out my mistakes, I fixed these.
I tried to test (make unit-tests
and make tests
) again,
and then unit-tests
was succeeded but whole tests
wasn't as well you.
But I can see these failed test.log like following.
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //pkg/sentry/fdimport:fdimport_nogo
-----------------------------------------------------------------------------
printf: pkg/sentry/socket/netstack/stack.go:470:10: fmt.Errorf format %w has arg err of wrong type gvisor.dev/gvisor/pkg/tcpip.Error
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //pkg/sentry/control:control_nogo
-----------------------------------------------------------------------------
printf: pkg/sentry/socket/netstack/stack.go:470:10: fmt.Errorf format %w has arg err of wrong type gvisor.dev/gvisor/pkg/tcpip.Error
There are many errors because of same reason. tcpip.Error is different from standard error and doesn't have Error() function. I think That's why these error occur. But I'm not sure very well because I'm not familiar to Golang's detail. So could you check it?
I posted same content in my pull request. (https://github.com/google/gvisor/pull/7285#issuecomment-1068780253)
I fixed it and then succeeded unit-tests
and nogo-tests
.
But I didn't succeed container-tests
and syscall-tests
because of timeout.
Okay thanks, I'll check tonight
@Yuya9786 Me too test failed, but not timeout error. I don't know why occurred this errors...
A lot of following errors.
D0317 14:14:10.953592 25 container.go:989] Starting gofer: /tmp/use-error-wrapping/runsc [runsc-gofer --root=/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/sandbox/linux-sandbox/3596/execroot/__main__/_tmp/610a281328b4be58d07ead1cbd77ef2b/containers3572142354 --debug=true --debug-log=/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/sandbox/linux-sandbox/3596/execroot/__main__/bazel-out/k8-fastbuild/testlogs/runsc/container/container_test/shard_3_of_4/test.outputs/runsc.log.TestMultiContainerSharedMountRestart.%TIMESTAMP%.%COMMAND% --network=none --log-packets=true --platform=kvm --strace=true --watchdog-action=panic --vfs2=false --TESTONLY-unsafe-nonroot=true --debug-log-fd=3 gofer --bundle /root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/sandbox/linux-sandbox/3596/execroot/__main__/_tmp/610a281328b4be58d07ead1cbd77ef2b/bundle1403834794 --spec-fd=4 --mounts-fd=5 --io-fds=6 --io-fds=7]
D0317 14:14:10.977137 25 container.go:729] Destroy container, cid: test-container-KRBNGSQ7UCEVRSOVU7CTBNIIJYCG4MNK
--- FAIL: TestMultiContainerSharedMountRestart (0.12s)
--- FAIL: TestMultiContainerSharedMountRestart/ptrace (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
--- FAIL: TestMultiContainerSharedMountRestart/kvm (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
--- FAIL: TestMultiContainerSharedMountRestart/ptrace-overlay (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
--- FAIL: TestMultiContainerSharedMountRestart/kvm-overlay (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
--- FAIL: TestMultiContainerSharedMountRestart/ptrace-vfs1 (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
--- FAIL: TestMultiContainerSharedMountRestart/kvm-vfs1 (0.02s)
multi_container_test.go:1494: error starting containers: error creating container: gofer: fork/exec /tmp/use-error-wrapping/runsc: no such file or directory
================================================================================
[3,640 / 3,689] 1 / 3 tests, 1 failed; [Prepa] Analyzing //pkg/sentry/fsimpl/verity:verity ... (2 actions, 0 running)
[3,683 / 3,689] 1 / 3 tests, 1 failed; [Prepa] Analyzing //runsc/boot:boot
INFO: Elapsed time: 216.069s, Critical Path: 200.11s
INFO: 1831 processes: 16 internal, 1487 linux-sandbox, 328 local.
INFO: Build completed, 1 test FAILED, 1831 total actions
//runsc/container:container_nogo PASSED in 0.1s
//runsc/container:container_test_nogo PASSED in 0.1s
//runsc/container:container_test FAILED in 4 out of 4 in 4.0s
Stats over 4 runs: max = 4.0s, min = 1.9s, avg = 2.5s, dev = 0.8s
/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/runsc/container/container_test/shard_2_of_4/test.log
/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/runsc/container/container_test/shard_4_of_4/test.log
/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/runsc/container/container_test/shard_1_of_4/test.log
/root/.cache/bazel/_bazel_root/c72a1d54bb3652b1e51b83ebaffd2eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/runsc/container/container_test/shard_3_of_4/test.log
Executed 3 out of 3 tests: 2 tests pass and 1 fails locally.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
INFO: Build completed, 1 test FAILED, 1831 total actions
INFO: Build Event Protocol files produced successfully.
INFO: Build completed, 1 test FAILED, 1831 total actions
Makefile:210: recipe for target 'container-tests' failed
make: *** [container-tests] Error 3
A lot of following errors.
Executed 1234 out of 1234 tests: 161 tests pass and 1073 fail locally.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
INFO: Build completed, 1073 tests FAILED, 7973 total actions
INFO: Build Event Protocol files produced successfully.
INFO: Build completed, 1073 tests FAILED, 7973 total actions
Makefile:227: recipe for target 'syscall-tests' failed
make: *** [syscall-tests] Error 3
For now, your PR's CI failed by simple issue. The code you fixed is looks no problem. I think that CI will pass by fix this, so I think it is a good idea to try that first. https://github.com/google/gvisor/pull/7285#issuecomment-1070982797
@ryo-yamaoka Thank you for your help. I haven't yet figured out the cause of this error too.
Is this issue still active? I'd like to try taking on this as my first issue
it seems that @Yuya9786 had a PR which was ready to be merged, while there are some conflicts with the master branch.
You may confirm with the author to see if it will be updated.
I think my PR was approved by two reviewers and I resolved the conflicts once, but it's not been merged. So honestly I don't know what to do
hey @Yuya9786 thanks for the pr, it seems that there are still some conflicts that block the merge, e.g. VFS1 was completed removed at pkg/sentry/fs which your change are also applied to.
Could you rebase your change and resolve those conflicts? Then we shall be able to merge the pull request.
A friendly reminder that this issue had no activity for 120 days.
Make use of the new error wrapping functionality and API to be able to check error types easier.
https://blog.golang.org/go1.13-errors