{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/19498","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/19498/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/19498/comments","events_url":"https://api.github.com/repos/docker/docker/issues/19498/events","html_url":"https://github.com/docker/docker/pull/19498","id":127726970,"number":19498,"title":"use pubsub instead of filenotify to follow json logs","user":{"login":"mountkin","id":1496652,"avatar_url":"https://avatars.githubusercontent.com/u/1496652?v=3","gravatar_id":"","url":"https://api.github.com/users/mountkin","html_url":"https://github.com/mountkin","followers_url":"https://api.github.com/users/mountkin/followers","following_url":"https://api.github.com/users/mountkin/following{/other_user}","gists_url":"https://api.github.com/users/mountkin/gists{/gist_id}","starred_url":"https://api.github.com/users/mountkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mountkin/subscriptions","organizations_url":"https://api.github.com/users/mountkin/orgs","repos_url":"https://api.github.com/users/mountkin/repos","events_url":"https://api.github.com/users/mountkin/events{/privacy}","received_events_url":"https://api.github.com/users/mountkin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/status/2-code-review","name":"status/2-code-review","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2016-01-20T16:51:21Z","updated_at":"2016-02-24T01:37:10Z","closed_at":"2016-02-16T21:55:49Z","pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/19498","html_url":"https://github.com/docker/docker/pull/19498","diff_url":"https://github.com/docker/docker/pull/19498.diff","patch_url":"https://github.com/docker/docker/pull/19498.patch"},"body":"inotify event is trigged immediately there's data written to disk.\r\nBut at the time that the inotify event is received, the json line might\r\nnot fully saved to disk. If the json decoder tries to decode in such\r\ncase, an io.UnexpectedEOF will be trigged.\r\nWe used to retry for several times to mitigate the io.UnexpectedEOF error.\r\nBut there are still flaky tests caused by the partial log entries.\r\n\r\nThe daemon knows exactly when there are new log entries emitted. We can\r\nuse the pubsub package to notify all the log readers instead of inotify.\r\n\r\nBTW: I can't run the test locally because the testing infrastructure seems to be broken on my laptop.\r\n\r\n```\r\n---> Making bundle: test-integration-cli (in bundles/1.10.0-dev/test-integration-cli)\r\n---> Making bundle: .integration-daemon-start (in bundles/1.10.0-dev/test-integration-cli)\r\n+++ /etc/init.d/apparmor start\r\n * Starting AppArmor profiles\r\nSkipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd\r\n   ...done.\r\nINFO: Waiting for daemon to start...\r\n+++ exec docker daemon --debug --host unix:///go/src/github.com/docker/docker/bundles/1.10.0-dev/test-integration-cli/docker.sock --storage-driver vfs --pidfile bundles/1.10.0-dev/test-integration-cli/docker.pid --userland-proxy=true\r\n.\r\n---> Making bundle: .integration-daemon-setup (in bundles/1.10.0-dev/test-integration-cli)\r\n---> Making bundle: .detect-daemon-osarch (in bundles/1.10.0-dev/test-integration-cli)\r\n---> Making bundle: .ensure-emptyfs (in bundles/1.10.0-dev/test-integration-cli)\r\n++++ tar -cC bundles/1.10.0-dev/test-integration-cli/emptyfs .\r\n++++ docker load\r\n---> Making bundle: .ensure-frozen-images (in bundles/1.10.0-dev/test-integration-cli)\r\n++++ tar -cC /docker-frozen-images .\r\n++++ docker load\r\nError response from daemon: ApplyLayer exit status 1 stdout:  stderr: unexpected EOF\r\n+++ bundle .integration-daemon-stop\r\n+++ local bundle=.integration-daemon-stop\r\n/go/src/github.com/docker/docker/hack/make.sh: line 257: local: can only be used in a function\r\n```\r\n\r\nSigned-off-by: Shijiang Wei <mountkin@gmail.com>"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/188002530","html_url":"https://github.com/docker/docker/pull/19498#issuecomment-188002530","issue_url":"https://api.github.com/repos/docker/docker/issues/19498","id":188002530,"user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T01:37:10Z","updated_at":"2016-02-24T01:37:10Z","body":"And that's with the file poller too, not inotify."}}