-
Notifications
You must be signed in to change notification settings - Fork 47
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
criu swrk: return child error to caller #175
Conversation
Ok so I understand why the CI tests hang. When capturing output like this in go, the go std lib creates a pipe that is setup on stout/err in the child. After wait() is called on the child go then tries to read all remaining output from the pipe fd set one stdout/err on the child until EOF. However this has one major problem, when the stdout/err file descriptors in the child are then given to other processes. In the hanging tests case this seems to be in the case of CriuReqType_PAGE_SERVER_CHLD which causes a normal fork in the criu swrk process to create criu: page-server which inherits stdout/err. I don't have a good answer for this, either we try to make criu close the std fds (dups them to /dev/null) when it forks that there or we do not capture the output at all. Or maybe we special case CriuReqType_PAGE_SERVER_CHLD to not capture output in only this case but I have no idea about criu at all so I don't know if this would effect more options. Of course I would like to get the output because without debugging failures is basically impossible. |
64ad5bb
to
202cbba
Compare
@rst0git There is no point in rebasing this. I need an answer on the issue raised above. So either I add a special exclude CriuReqType_PAGE_SERVER_CHLD (not sure if there are more we need to worry about) from output capture or I do not try to capture the output at all. I like the output capture of course. |
@Luap99 In general, CRIU writes all output to a log file (e.g., opencontainers/runc@c77aaa3). We don't capture any output from stdout for |
I am not talking about any container runtime involvement here. The fact is that this library just fails with a useless error (write criu-xprt-cln: broken pipe) when the swrk process fails. I can capture the wait error but than we only get the exit code not whatever errors criu pritned to stderr, i.e. Are you telling me this library should always create a log when starting the swrk process? And then read this file after wait? |
@avagin Do you have any ideas on how we could capture the CRIU logs in go-criu? For example, the following repository contains a simple program that prints the version of CRIU:
If we create the following configuration file, it will cause
However, this error is not captured in stdout/stderr:
A similar problem appears with the CI tests for Podman (containers/podman#18856). |
Ok I understand now, I got confused by the perror lines then as I assumed they print to stderr but if they redirect it into the a log file then it will not help us. |
I guess I push my change without the output capture for now, getting a exit status 1 or killed would already tell us more useful things in podman. |
In the podman CI we are seeing a weird flake during criu version detection[1]. The write to the socket just fails with broken pipe. The logical thing to assume here is that the child exited. However the current code never reports back the child error from wait. The cleanup error is now added to the returned error so the caller sees both. The output is not captured as this causes hangs when the fds are passed into child processes. As errors.Join is used from the std lib bump the minimum go version to 1.20. [1] containers/podman#18856 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #175 +/- ##
==========================================
- Coverage 50.13% 49.94% -0.19%
==========================================
Files 21 21
Lines 1889 1898 +9
==========================================
+ Hits 947 948 +1
- Misses 810 814 +4
- Partials 132 136 +4 ☔ View full report in Codecov by Sentry. |
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.
LGTM
There is no new version yet but we like to use the new code[1] to debug a flake[2] in the podman CI. It will not fix it but the new error might give us a better idea what is going on. [1] checkpoint-restore/go-criu#175 [2] containers#18856 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
There is no new version yet but we like to use the new code[1] to debug a flake[2] in the podman CI. It will not fix it but the new error might give us a better idea what is going on. [1] checkpoint-restore/go-criu#175 [2] containers#18856 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
In the podman CI we are seeing a weird flake during criu version detection[1]. The write to the socket just fails with broken pipe. The logical thing to assume here is that the child exited. However the current code never reports back the child error from wait nor does it try to capture the output from it. This fixes both. The cleanup error is now added to the returned error so the caller sees both.
As errors.Join is used from the std lib bump the minimum go version to 1.20.
[1] containers/podman#18856