{"action":"opened","number":25392,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/25392","id":73629790,"html_url":"https://github.com/rails/rails/pull/25392","diff_url":"https://github.com/rails/rails/pull/25392.diff","patch_url":"https://github.com/rails/rails/pull/25392.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/25392","number":25392,"state":"open","locked":false,"title":"Experimental Alternative to #25302","user":{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false},"body":"With #25302 we have to assume that the files on disk have changed in a fork. This means that the first call to `updated? must always be true. Instead we can use 3 different IO.pipe to synchronize communications between between any number of forked processes.\r\n\r\nWe use 1 pipe for the primary communication, another pipe is used by children to notify the parent that a new fork has booted. Once a child is detected as being booted a value is written to the primary pipe either 'T' if the files have changed or 'F' if they haven't. Once the value is read the same pipe responds with on the final pipe with an ACK. This lets the parent know that 1 of the processes has received a message and it can begin waiting for the next process to boot.\r\n\r\nThere exists a scenario where a race condition is possible. Parent PID boots, and there's no changes on disk. Child process boots and asks the parent if there are any changes. The parent PID may send a \"F\" to the child but between the time that the \"F\" is sent and it is read the file may change. We can eliminate this race condition if we boot the listener on the child process before we tell the parent that the child has booted. That's exactly what this PR does, is hooks into the `before_listen` and uses that to boot a worker before we even tell the parent process we've booted.\r\n\r\nAs is this is a WIP and more of a proof of concept. I think it's an interesting solution that may possibly be viable. It seems more technically complete than #25302 however that completeness comes at additional complexity. cc @e2","created_at":"2016-06-13T19:30:51Z","updated_at":"2016-06-13T19:30:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/25392/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/25392/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/25392/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/04daacdf112190aec58e1747d2e7e9937dbf3bcb","head":{"label":"schneems:schneems/evented-file-boot-pipe","ref":"schneems/evented-file-boot-pipe","sha":"04daacdf112190aec58e1747d2e7e9937dbf3bcb","user":{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false},"repo":{"id":2873136,"name":"rails","full_name":"schneems/rails","owner":{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/schneems/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/schneems/rails","forks_url":"https://api.github.com/repos/schneems/rails/forks","keys_url":"https://api.github.com/repos/schneems/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schneems/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schneems/rails/teams","hooks_url":"https://api.github.com/repos/schneems/rails/hooks","issue_events_url":"https://api.github.com/repos/schneems/rails/issues/events{/number}","events_url":"https://api.github.com/repos/schneems/rails/events","assignees_url":"https://api.github.com/repos/schneems/rails/assignees{/user}","branches_url":"https://api.github.com/repos/schneems/rails/branches{/branch}","tags_url":"https://api.github.com/repos/schneems/rails/tags","blobs_url":"https://api.github.com/repos/schneems/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schneems/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schneems/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/schneems/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schneems/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/schneems/rails/languages","stargazers_url":"https://api.github.com/repos/schneems/rails/stargazers","contributors_url":"https://api.github.com/repos/schneems/rails/contributors","subscribers_url":"https://api.github.com/repos/schneems/rails/subscribers","subscription_url":"https://api.github.com/repos/schneems/rails/subscription","commits_url":"https://api.github.com/repos/schneems/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/schneems/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/schneems/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/schneems/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/schneems/rails/contents/{+path}","compare_url":"https://api.github.com/repos/schneems/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schneems/rails/merges","archive_url":"https://api.github.com/repos/schneems/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schneems/rails/downloads","issues_url":"https://api.github.com/repos/schneems/rails/issues{/number}","pulls_url":"https://api.github.com/repos/schneems/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/schneems/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/schneems/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schneems/rails/labels{/name}","releases_url":"https://api.github.com/repos/schneems/rails/releases{/id}","deployments_url":"https://api.github.com/repos/schneems/rails/deployments","created_at":"2011-11-29T06:48:49Z","updated_at":"2015-01-08T18:17:54Z","pushed_at":"2016-06-13T15:20:46Z","git_url":"git://github.com/schneems/rails.git","ssh_url":"git@github.com:schneems/rails.git","clone_url":"https://github.com/schneems/rails.git","svn_url":"https://github.com/schneems/rails","homepage":"http://rubyonrails.org","size":125900,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"f27a932d6f0a3c991c3e8b1968236c79f2c1936a","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","deployments_url":"https://api.github.com/repos/rails/rails/deployments","created_at":"2008-04-11T02:19:47Z","updated_at":"2016-06-13T17:26:15Z","pushed_at":"2016-06-13T19:30:52Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":346504,"stargazers_count":31535,"watchers_count":31535,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12775,"mirror_url":null,"open_issues_count":1049,"forks":12775,"open_issues":1049,"watchers":31535,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/25392"},"html":{"href":"https://github.com/rails/rails/pull/25392"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/25392"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/25392/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/25392/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/25392/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/04daacdf112190aec58e1747d2e7e9937dbf3bcb"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":6,"additions":176,"deletions":6,"changed_files":2}}
{"actor":{"display_login":"schneems"}}