{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/12704","labels_url":"https://api.github.com/repos/docker/docker/issues/12704/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/12704/comments","events_url":"https://api.github.com/repos/docker/docker/issues/12704/events","html_url":"https://github.com/docker/docker/issues/12704","id":70471247,"number":12704,"title":"logs with follow=1 should always be replied immediately","user":{"login":"a-ba","id":6051986,"avatar_url":"https://avatars.githubusercontent.com/u/6051986?v=3","gravatar_id":"","url":"https://api.github.com/users/a-ba","html_url":"https://github.com/a-ba","followers_url":"https://api.github.com/users/a-ba/followers","following_url":"https://api.github.com/users/a-ba/following{/other_user}","gists_url":"https://api.github.com/users/a-ba/gists{/gist_id}","starred_url":"https://api.github.com/users/a-ba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-ba/subscriptions","organizations_url":"https://api.github.com/users/a-ba/orgs","repos_url":"https://api.github.com/users/a-ba/repos","events_url":"https://api.github.com/users/a-ba/events{/privacy}","received_events_url":"https://api.github.com/users/a-ba/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-23T17:49:42Z","updated_at":"2015-04-23T18:41:43Z","closed_at":null,"body":"When calling `GET /containers/(id)/logs?follow=1` on a container which has **not yet produced any output** the current behaviour of the engine is to delay the HTTP response until the container writes some output.\r\n\r\nThe client cannot guess if the command is successful until some data is received.\r\n\r\nThis is problematic for example when you need to make the request in the foreground thread and process its output in a background thread. In python you would write something like:\r\n```py\r\n    gen = client.logs(container, follow=True)\r\n    executor.submit(func, gen)\r\n```\r\nclient.logs() returns a generator that is sent to another thread. However if the container log is empty then client.logs() hangs and will return the generator only when some output is available.\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/95680602","html_url":"https://github.com/docker/docker/issues/12704#issuecomment-95680602","issue_url":"https://api.github.com/repos/docker/docker/issues/12704","id":95680602,"user":{"login":"a-ba","id":6051986,"avatar_url":"https://avatars.githubusercontent.com/u/6051986?v=3","gravatar_id":"","url":"https://api.github.com/users/a-ba","html_url":"https://github.com/a-ba","followers_url":"https://api.github.com/users/a-ba/followers","following_url":"https://api.github.com/users/a-ba/following{/other_user}","gists_url":"https://api.github.com/users/a-ba/gists{/gist_id}","starred_url":"https://api.github.com/users/a-ba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-ba/subscriptions","organizations_url":"https://api.github.com/users/a-ba/orgs","repos_url":"https://api.github.com/users/a-ba/repos","events_url":"https://api.github.com/users/a-ba/events{/privacy}","received_events_url":"https://api.github.com/users/a-ba/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T18:41:43Z","updated_at":"2015-04-23T18:41:43Z","body":"the HTTP status and the headers (both are needed for parsing the response)\n\n"}}