{"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/pouch/issues/2258","repository_url":"https://api.github.com/repos/alibaba/pouch","labels_url":"https://api.github.com/repos/alibaba/pouch/issues/2258/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/pouch/issues/2258/comments","events_url":"https://api.github.com/repos/alibaba/pouch/issues/2258/events","html_url":"https://github.com/alibaba/pouch/pull/2258","id":361852902,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NzE5OTU5","number":2258,"title":"[RFC] bugfix: call task.CloseIO after client close stdin","user":{"login":"fuweid","id":17510957,"node_id":"MDQ6VXNlcjE3NTEwOTU3","avatar_url":"https://avatars3.githubusercontent.com/u/17510957?v=4","gravatar_id":"","url":"https://api.github.com/users/fuweid","html_url":"https://github.com/fuweid","followers_url":"https://api.github.com/users/fuweid/followers","following_url":"https://api.github.com/users/fuweid/following{/other_user}","gists_url":"https://api.github.com/users/fuweid/gists{/gist_id}","starred_url":"https://api.github.com/users/fuweid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fuweid/subscriptions","organizations_url":"https://api.github.com/users/fuweid/orgs","repos_url":"https://api.github.com/users/fuweid/repos","events_url":"https://api.github.com/users/fuweid/events{/privacy}","received_events_url":"https://api.github.com/users/fuweid/received_events","type":"User","site_admin":false},"labels":[{"id":722344260,"node_id":"MDU6TGFiZWw3MjIzNDQyNjA=","url":"https://api.github.com/repos/alibaba/pouch/labels/conflict/needs-rebase","name":"conflict/needs-rebase","color":"cccccc","default":false},{"id":684575943,"node_id":"MDU6TGFiZWw2ODQ1NzU5NDM=","url":"https://api.github.com/repos/alibaba/pouch/labels/kind/bug","name":"kind/bug","color":"f77e56","default":false},{"id":722355278,"node_id":"MDU6TGFiZWw3MjIzNTUyNzg=","url":"https://api.github.com/repos/alibaba/pouch/labels/size/XL","name":"size/XL","color":"f4abdb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/alibaba/pouch/milestones/6","html_url":"https://github.com/alibaba/pouch/milestone/6","labels_url":"https://api.github.com/repos/alibaba/pouch/milestones/6/labels","id":3718347,"node_id":"MDk6TWlsZXN0b25lMzcxODM0Nw==","number":6,"title":"v1.1","description":"containerd has been released to v1.2, which improves the performance and fixes issues. pouchcontainer `ctrd` package is designed before containerd v1.0.0 so that there needs changes to `ctrd` package before using v1.2 containerd.","creator":{"login":"fuweid","id":17510957,"node_id":"MDQ6VXNlcjE3NTEwOTU3","avatar_url":"https://avatars3.githubusercontent.com/u/17510957?v=4","gravatar_id":"","url":"https://api.github.com/users/fuweid","html_url":"https://github.com/fuweid","followers_url":"https://api.github.com/users/fuweid/followers","following_url":"https://api.github.com/users/fuweid/following{/other_user}","gists_url":"https://api.github.com/users/fuweid/gists{/gist_id}","starred_url":"https://api.github.com/users/fuweid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fuweid/subscriptions","organizations_url":"https://api.github.com/users/fuweid/orgs","repos_url":"https://api.github.com/users/fuweid/repos","events_url":"https://api.github.com/users/fuweid/events{/privacy}","received_events_url":"https://api.github.com/users/fuweid/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":1,"state":"open","created_at":"2018-10-08T02:55:30Z","updated_at":"2018-10-18T05:24:15Z","due_on":"2018-11-30T08:00:00Z","closed_at":null},"comments":3,"created_at":"2018-09-19T17:36:09Z","updated_at":"2018-10-23T05:36:28Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/alibaba/pouch/pulls/2258","html_url":"https://github.com/alibaba/pouch/pull/2258","diff_url":"https://github.com/alibaba/pouch/pull/2258.diff","patch_url":"https://github.com/alibaba/pouch/pull/2258.patch"},"body":"Signed-off-by: Wei Fu <fuweid89@gmail.com>\r\n\r\n<!-- \r\nPlease make sure you have read and understood the contributing guidelines;\r\nhttps://github.com/alibaba/pouch/blob/master/CONTRIBUTING.md -->\r\n\r\n### Ⅰ. Describe what this PR did\r\n\r\nfor now, the stream from client to container is like:\r\n\r\nos.Stdin -> [pouchd] ContainerIO [hijack backend] -> [containerd] FIFO\r\n\r\nWhen the client input EOF by control+D, the hijack backend will quit the\r\ngoroutin about reading data from client side and close.\r\n\r\nThe hijack backend is one of backends in stdin ContainerIO. But the\r\nhajack backend closes without closing the stdin ContainerIO. The\r\ncontainer will wait for the data from FIFO.\r\n\r\npouch daemon needs to close the stdin ContainerIO when the backend, like\r\nhijack, closes. Therefore, pouch daemon closes the write side of fifo.\r\n\r\nBesides this, the containerd also open fifo with both write and read\r\nmodes. It's not enough to close write side of fifo in pouch daemon.\r\npouch daemon also calls the CloseIO rpc to close write side in the\r\ncontainerd-shim.\r\n\r\n### Ⅱ. Does this pull request fix one issue?\r\n<!--If that, add \"fixes #xxxx\" below in the next line, for example, fixes #15. Otherwise, add \"NONE\" -->\r\n\r\nNONE\r\n\r\n### Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗？)\r\n\r\nwait for #2257\r\n\r\n\r\n### Ⅳ. Describe how to verify it\r\n\r\nwe should send the EOF to close to exit but typing exit command.\r\n\r\n```\r\n# vagrant @ ubuntu-xenial in ~/go/src/github.com/alibaba/pouch on git:bugfix_close_stdin o [1:32:02]\r\n$ sudo pouch run -i --name testing busybox cat # ending by control+D\r\nhi\r\nhi\r\nbye\r\nbye\r\n\r\n\r\n\r\n# vagrant @ ubuntu-xenial in ~/go/src/github.com/alibaba/pouch on git:bugfix_close_stdin o [1:32:26]\r\n$ sudo pouch ps -a | grep testing\r\ntesting   2910e3   Exited (0) 10 seconds   17 seconds ago   registry.hub.docker.com/library/busybox:latest   runc\r\n```\r\n\r\n### Ⅴ. Special notes for reviews\r\n\r\n1. we should close the conn by `CloseWriter` and waiting for the data in run/exec command\r\n2. when we use `echo 1 | sudo pouch run -i busybox cat`, we got nothing but should get `1`. This is bug for us. Since we use ringbuffer to cache the input, when we close the ContainerIO, no one can touch the data in the ringbuffer. I will send other PR to fix this.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/alibaba/pouch/issues/comments/432099309","html_url":"https://github.com/alibaba/pouch/pull/2258#issuecomment-432099309","issue_url":"https://api.github.com/repos/alibaba/pouch/issues/2258","id":432099309,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjA5OTMwOQ==","user":{"login":"pouchrobot","id":33292901,"node_id":"MDQ6VXNlcjMzMjkyOTAx","avatar_url":"https://avatars1.githubusercontent.com/u/33292901?v=4","gravatar_id":"","url":"https://api.github.com/users/pouchrobot","html_url":"https://github.com/pouchrobot","followers_url":"https://api.github.com/users/pouchrobot/followers","following_url":"https://api.github.com/users/pouchrobot/following{/other_user}","gists_url":"https://api.github.com/users/pouchrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/pouchrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pouchrobot/subscriptions","organizations_url":"https://api.github.com/users/pouchrobot/orgs","repos_url":"https://api.github.com/users/pouchrobot/repos","events_url":"https://api.github.com/users/pouchrobot/events{/privacy}","received_events_url":"https://api.github.com/users/pouchrobot/received_events","type":"User","site_admin":false},"created_at":"2018-10-23T05:36:28Z","updated_at":"2018-10-23T05:36:28Z","author_association":"COLLABORATOR","body":"ping @fuweid \nConflict happens after merging a previous commit.\nPlease rebase the branch against master and push it back again. Thanks a lot.\n"}}
{"actor":{"display_login":"pouchrobot"}}