-
Notifications
You must be signed in to change notification settings - Fork 564
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
StartExec does not wait for process to finish if stdout/stderr not passed in #838
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
no 😁 |
@fsouza Would you accept a PR to fix this? |
Hi @zombiezen, I think using ioutil.Discard makes sense. PR is welcome! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
- This bug was due to a bug in the vendored client library where StartExec would return early even if opts.Detatch was true, if stderr and stdout were not provided. This fix always attaches them and falls back to io.Discard if the user does not provide their own readers. - See: fsouza/go-dockerclient#838 - Fixes ory#372
If this fix is acceptable upstream, I can port it here, too. I’ll issue a PR shortly. Just really needed it in doclertest first. |
Sounds good! That change looks good to me |
It seems as if the fix for this is a bit more difficult than with its consequences in Dockertest. If you look at my tests, the one involving a sleep fails. I believe this is because the The test with Unless I'm missing something, the options to fix this now seem to be:
None are great, but at least option 4 is the least invasive. Thoughts? |
This bug was due to a bug in the vendored client library where StartExec would return early even if opts.Detatch was true, if stderr and stdout were not provided. This fix always attaches them and falls back to io.Discard if the user does not provide their own readers. See: fsouza/go-dockerclient#838 Fixes #372
Thanks for the detailed analysis and apologies for the delayed response. I'm leaning towards 3, but I'm also curious how other SDKs are solving this. Do you know? I may take a loot at it tomorrow to see if we can get some "inspiration" elsewhere :) |
Calling
StartExec
(even withoutDetach: true
) will not wait until the process finishes if stdout/stderr are not passed in. IIUC the problem is this branch:go-dockerclient/client.go
Lines 793 to 794 in fa0591b
I believe the fix is to always use
ioutil.Discard
for stdout/stderr and synchronize on the streams closing.The text was updated successfully, but these errors were encountered: