{"action":"created","issue":{"url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/821","repository_url":"https://api.github.com/repos/collectiveidea/delayed_job","labels_url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/821/labels{/name}","comments_url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/821/comments","events_url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/821/events","html_url":"https://github.com/collectiveidea/delayed_job/issues/821","id":87285915,"number":821,"title":"delayed_job process on OSX consistently consuming massive amounts of system resources","user":{"login":"constantm","id":292439,"avatar_url":"https://avatars.githubusercontent.com/u/292439?v=3","gravatar_id":"","url":"https://api.github.com/users/constantm","html_url":"https://github.com/constantm","followers_url":"https://api.github.com/users/constantm/followers","following_url":"https://api.github.com/users/constantm/following{/other_user}","gists_url":"https://api.github.com/users/constantm/gists{/gist_id}","starred_url":"https://api.github.com/users/constantm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/constantm/subscriptions","organizations_url":"https://api.github.com/users/constantm/orgs","repos_url":"https://api.github.com/users/constantm/repos","events_url":"https://api.github.com/users/constantm/events{/privacy}","received_events_url":"https://api.github.com/users/constantm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-06-11T09:52:57Z","updated_at":"2016-11-09T15:04:03Z","closed_at":null,"body":"I've had this issue for a while on Yosemite, and it still persists after a reinstall. When starting delayed_job, it runs fine for a few minutes, after which the ruby process starts eating more and more CPU resources until it caps out at 100% and brings the Mac to a halt. The job queue is empty while this happens. Looking at CPU usage, it seems to start with the usage of the Ruby process shooting up every few seconds, and then gets worse and worse. Not sure where to even start looking for the issue?\n\nI'm on OSX 10.10.3 (although it happened on earlier versions as well), Ruby 2.2.2 (it also happened on previous versions) and delayed_job 4.0.6.\n\n![](http://i.imgur.com/zZFrqno.jpg)\n"},"comment":{"url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/comments/259435251","html_url":"https://github.com/collectiveidea/delayed_job/issues/821#issuecomment-259435251","issue_url":"https://api.github.com/repos/collectiveidea/delayed_job/issues/821","id":259435251,"user":{"login":"jturkel","id":2598096,"avatar_url":"https://avatars.githubusercontent.com/u/2598096?v=3","gravatar_id":"","url":"https://api.github.com/users/jturkel","html_url":"https://github.com/jturkel","followers_url":"https://api.github.com/users/jturkel/followers","following_url":"https://api.github.com/users/jturkel/following{/other_user}","gists_url":"https://api.github.com/users/jturkel/gists{/gist_id}","starred_url":"https://api.github.com/users/jturkel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jturkel/subscriptions","organizations_url":"https://api.github.com/users/jturkel/orgs","repos_url":"https://api.github.com/users/jturkel/repos","events_url":"https://api.github.com/users/jturkel/events{/privacy}","received_events_url":"https://api.github.com/users/jturkel/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T15:04:03Z","updated_at":"2016-11-09T15:04:03Z","body":"For anyone interested here's a monkey patch that causes workers to only reload code before running a job rather than during each iteration of the job polling loop. On my machine it cuts CPU usage of an idle worker from 30% to 0.2%.\r\n\r\n```ruby\r\nmodule Delayed::WorkerClassReloadingPatch\r\n  # Override Delayed::Worker#run to optionally reload classes before running a job\r\n  def run(*)\r\n    if self.class.reload_app?\r\n      ActionDispatch::Reloader.cleanup!\r\n      ActionDispatch::Reloader.prepare!\r\n    end\r\n\r\n    super\r\n  end\r\n\r\n  # Override Delayed::Worker#reload! which is called from the job polling loop to not reload classes\r\n  def reload!\r\n    # no-op\r\n  end\r\nend\r\nDelayed::Worker.send(:prepend, Delayed::WorkerClassReloadingPatch)\r\n```"}}
{"actor":{"display_login":"jturkel"}}