{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/24981","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/24981/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/24981/comments","events_url":"https://api.github.com/repos/rails/rails/issues/24981/events","html_url":"https://github.com/rails/rails/issues/24981","id":154306132,"number":24981,"title":"RFC: Simplify code reloading by way of fs-events and forking","user":{"login":"tenderlove","id":3124,"avatar_url":"https://avatars2.githubusercontent.com/u/3124?v=3","gravatar_id":"","url":"https://api.github.com/users/tenderlove","html_url":"https://github.com/tenderlove","followers_url":"https://api.github.com/users/tenderlove/followers","following_url":"https://api.github.com/users/tenderlove/following{/other_user}","gists_url":"https://api.github.com/users/tenderlove/gists{/gist_id}","starred_url":"https://api.github.com/users/tenderlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenderlove/subscriptions","organizations_url":"https://api.github.com/users/tenderlove/orgs","repos_url":"https://api.github.com/users/tenderlove/repos","events_url":"https://api.github.com/users/tenderlove/events{/privacy}","received_events_url":"https://api.github.com/users/tenderlove/received_events","type":"User","site_admin":true},"labels":[{"id":128692,"url":"https://api.github.com/repos/rails/rails/labels/needs%20feedback","name":"needs feedback","color":"ededed","default":false},{"id":107195,"url":"https://api.github.com/repos/rails/rails/labels/railties","name":"railties","color":"8BE06E","default":false},{"id":12449438,"url":"https://api.github.com/repos/rails/rails/labels/stale","name":"stale","color":"444444","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-05-11T18:05:35Z","updated_at":"2017-05-24T03:52:21Z","closed_at":null,"body":"Our auto-reload code has always been a pain for maintenance and it's very difficult to understand.  I'd like to propose a change to the way we do reloading.\n## General idea\n\nRun a forking server in development.  The parent process can pre-load framework code and gems.  Child processes will load application code via normal methods like `require` and `autoload`.  If our FS monitor detects anything changes and a reload needs to occur, it can send a signal to the parent process and have it reap it's children.  The newly born children will load the new code since the parent process didn't have any of the app code loaded.\n\nI think we only need to do this for models / controllers (or anything that is in the list in the config).  Views don't need to cause a reload because I think we already handle that in a different way.\n## Challenges\n1. We've talked about this many years ago, and there were blockers, but I don't remember what they were.  Maybe we don't have those blockers today.\n2. How will this work with ActiveJob and ActionCable?  Presumably we can tell ActiveJob to empty it's queue before we reap children, or we can ensure that any process that is doing jobs doesn't service requests (IOW, children currently being reaped won't service requests, but we can fork new children that do at the same time).  ActionCable, I have no idea.\n3. Platforms that don't support `fork` (like JRuby).  We should probably make our \"code reload\" a strategy object, and we can keep the old strategy for other platforms, until we figure out a better solution (or let platform maintainers deal with it).\n4. We need to disconnect from the database when reaping children.\n5. Is forking fast enough?  Can we create new child processes that are ready to serve requests after someone writes to a file but before they try to load the page (are they going to notice that we're killing / starting processes while doing normal dev work)?\n\nAll of the challenges I've thought of don't really seem like _blockers_ to me.  Are there any real blockers for doing this?  I think it would greatly simplify our reloading system.\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/303610520","html_url":"https://github.com/rails/rails/issues/24981#issuecomment-303610520","issue_url":"https://api.github.com/repos/rails/rails/issues/24981","id":303610520,"user":{"login":"rails-bot[bot]","id":28418009,"avatar_url":"https://avatars3.githubusercontent.com/in/2272?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-bot%5Bbot%5D","html_url":"https://github.com/app/rails-bot","followers_url":"https://api.github.com/users/rails-bot%5Bbot%5D/followers","following_url":"https://api.github.com/users/rails-bot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/rails-bot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-bot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-bot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/rails-bot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/rails-bot%5Bbot%5D/repos","events_url":"https://api.github.com/users/rails-bot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/rails-bot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2017-05-24T03:52:21Z","updated_at":"2017-05-24T03:52:21Z","body":"This issue has been automatically marked as stale because it has not been commented on for at least three months.\nThe resources of the Rails team are limited, and so we are asking for your help.\nIf you can still reproduce this error on the `5-1-stable` branch or on `master`, please reply with all of the information you have about it in order to keep the issue open.\nThank you for all your contributions.\n"}}
{"actor":{"display_login":"rails-bot"}}