{"action":"created","issue":{"url":"https://api.github.com/repos/puma/puma/issues/966","repository_url":"https://api.github.com/repos/puma/puma","labels_url":"https://api.github.com/repos/puma/puma/issues/966/labels{/name}","comments_url":"https://api.github.com/repos/puma/puma/issues/966/comments","events_url":"https://api.github.com/repos/puma/puma/issues/966/events","html_url":"https://github.com/puma/puma/issues/966","id":149967979,"number":966,"title":"# of worker processes keeps increasing","user":{"login":"jfeltesse-mdsol","id":13656490,"avatar_url":"https://avatars.githubusercontent.com/u/13656490?v=3","gravatar_id":"","url":"https://api.github.com/users/jfeltesse-mdsol","html_url":"https://github.com/jfeltesse-mdsol","followers_url":"https://api.github.com/users/jfeltesse-mdsol/followers","following_url":"https://api.github.com/users/jfeltesse-mdsol/following{/other_user}","gists_url":"https://api.github.com/users/jfeltesse-mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/jfeltesse-mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfeltesse-mdsol/subscriptions","organizations_url":"https://api.github.com/users/jfeltesse-mdsol/orgs","repos_url":"https://api.github.com/users/jfeltesse-mdsol/repos","events_url":"https://api.github.com/users/jfeltesse-mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/jfeltesse-mdsol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-21T05:03:59Z","updated_at":"2016-04-22T23:40:45Z","closed_at":null,"body":"Hi,\r\n\r\nUsing puma 3.4.0, ruby 2.3.0, rails 5 master (ref 4769fc4) on Ubuntu 14.04.\r\n\r\nThe `config/puma.rb` file looks like this:\r\n\r\n```ruby\r\nworkers ENV.fetch(\"PUMA_WORKERS\") { 2 }\r\nthreads_count = ENV.fetch(\"PUMA_THREADS\") { 10 }.to_i\r\nthreads threads_count, threads_count * 2\r\n\r\nport        ENV.fetch(\"HTTP_PORT\") { 3000 }\r\nenvironment ENV.fetch(\"RAILS_ENV\") { \"development\" }\r\n\r\npreload_app!\r\n\r\n# see https://github.com/puma/puma/commit/448c022\r\nforce_shutdown_after 5\r\n\r\non_worker_boot do\r\n ActiveSupport.on_load(:active_record) do\r\n   ActiveRecord::Base.establish_connection\r\n end\r\nend\r\n\r\nbefore_fork do\r\n  ActiveRecord::Base.connection_pool.disconnect!\r\nend\r\n```\r\n\r\nwe launch the app using the following command (the env variables in the config file above are not set so it's using the fallback values):\r\n```\r\nbundle exec rails server -P pids/puma.pid\r\n```\r\n\r\nThe way I understand this, it should create 2 workers that would spin up 10 threads and be allowed to grow to 20 threads each.\r\nThe cluster itself has its own process so we logically, right after deploying, get 3 puma related processes.\r\nThe problem is after a while and some access I end up with something like this:\r\n\r\n```\r\n$ ps x | grep puma\r\n 51345 ?        Sl     0:07 puma 3.4.0 (tcp://0.0.0.0:3000) [2016-04-21_00-57-21]\r\n 51612 ?        Sl     0:01 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 51631 ?        Sl     0:01 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 53849 ?        Sl     0:07 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 55646 ?        Sl     0:14 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 58487 ?        Sl     0:01 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 58836 ?        Sl     0:09 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 71431 ?        Sl     0:05 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 73312 ?        Sl     0:08 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 74331 ?        Sl     0:02 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 76710 ?        Sl     0:25 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 78787 ?        Sl     0:06 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 80857 ?        Sl     0:01 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 82359 ?        Sl     0:01 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 83776 ?        Sl     0:01 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 85847 ?        Sl     0:06 puma: cluster worker 0: 51345 [2016-04-21_00-57-21]\r\n 87966 ?        Sl     0:00 puma: cluster worker 1: 51345 [2016-04-21_00-57-21]\r\n 88829 pts/2    S+     0:00 grep --color=auto puma\r\n```\r\n\r\nEventually it eats up all the memory and everything freezes.\r\n\r\nThe only thing I can imagine could be \"uncharted\" territory would be we're using ActionCable on one page which is being kept open.\r\n\r\nAny pointers?"},"comment":{"url":"https://api.github.com/repos/puma/puma/issues/comments/213627282","html_url":"https://github.com/puma/puma/issues/966#issuecomment-213627282","issue_url":"https://api.github.com/repos/puma/puma/issues/966","id":213627282,"user":{"login":"evanphx","id":7,"avatar_url":"https://avatars.githubusercontent.com/u/7?v=3","gravatar_id":"","url":"https://api.github.com/users/evanphx","html_url":"https://github.com/evanphx","followers_url":"https://api.github.com/users/evanphx/followers","following_url":"https://api.github.com/users/evanphx/following{/other_user}","gists_url":"https://api.github.com/users/evanphx/gists{/gist_id}","starred_url":"https://api.github.com/users/evanphx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanphx/subscriptions","organizations_url":"https://api.github.com/users/evanphx/orgs","repos_url":"https://api.github.com/users/evanphx/repos","events_url":"https://api.github.com/users/evanphx/events{/privacy}","received_events_url":"https://api.github.com/users/evanphx/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T23:40:45Z","updated_at":"2016-04-22T23:40:45Z","body":"Well, that's interesting. By \"after a while\" do you mean the app is just sitting there or are you trying to restart it?"}}