{"action":"created","issue":{"url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/69","labels_url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/69/comments","events_url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/69/events","html_url":"https://github.com/baudehlo/node-phantom-simple/issues/69","id":101128983,"number":69,"title":"Long polling isn't cleaned up when exiting browsers","user":{"login":"RavenHursT","id":496983,"avatar_url":"https://avatars.githubusercontent.com/u/496983?v=3","gravatar_id":"","url":"https://api.github.com/users/RavenHursT","html_url":"https://github.com/RavenHursT","followers_url":"https://api.github.com/users/RavenHursT/followers","following_url":"https://api.github.com/users/RavenHursT/following{/other_user}","gists_url":"https://api.github.com/users/RavenHursT/gists{/gist_id}","starred_url":"https://api.github.com/users/RavenHursT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RavenHursT/subscriptions","organizations_url":"https://api.github.com/users/RavenHursT/orgs","repos_url":"https://api.github.com/users/RavenHursT/repos","events_url":"https://api.github.com/users/RavenHursT/events{/privacy}","received_events_url":"https://api.github.com/users/RavenHursT/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-15T01:17:53Z","updated_at":"2015-08-17T16:55:35Z","closed_at":"2015-08-17T14:29:23Z","body":"So I have this ExpressJS server that I'm using your awesome library to help manage PhantomJS.\r\n\r\nThis server maintains a pool of browsers for each request to come in and utilitize to visit URLs and extract data about the pages when they load.  Every so often, depending on the amount of times a given browser in the \"pool\" is used, we kill that browser, remove it from the pool and replace it w/ a new one.\r\n\r\nThis has all been working swimmingly (pun intended) up until I started throwing thousands of requests at it.  Over time (after around 15K requests or so) I noticed that the CPU would end up just pegging at 100% on the server.  I ended up narrowing it down to the long polling that node-phantom-simple(NPS) is using to perform IPC.\r\n\r\nSo I went ahead and created a simple pull request that essentially kills the long poll for a given browser if and when it's explicitly exited from: https://github.com/baudehlo/node-phantom-simple/pull/68\r\n\r\nI'm sure there's a lot better ways to approach this (utilize phantom.killed?) but I needed something quick and dirty.. we have this running in production and I've now thrown 2X anything that I've thrown at it in the past and the CPU usages always come back down to normal after processing completes."},"comment":{"url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/comments/131888361","html_url":"https://github.com/baudehlo/node-phantom-simple/issues/69#issuecomment-131888361","issue_url":"https://api.github.com/repos/baudehlo/node-phantom-simple/issues/69","id":131888361,"user":{"login":"puzrin","id":319465,"avatar_url":"https://avatars.githubusercontent.com/u/319465?v=3","gravatar_id":"","url":"https://api.github.com/users/puzrin","html_url":"https://github.com/puzrin","followers_url":"https://api.github.com/users/puzrin/followers","following_url":"https://api.github.com/users/puzrin/following{/other_user}","gists_url":"https://api.github.com/users/puzrin/gists{/gist_id}","starred_url":"https://api.github.com/users/puzrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puzrin/subscriptions","organizations_url":"https://api.github.com/users/puzrin/orgs","repos_url":"https://api.github.com/users/puzrin/repos","events_url":"https://api.github.com/users/puzrin/events{/privacy}","received_events_url":"https://api.github.com/users/puzrin/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T16:55:35Z","updated_at":"2015-08-17T16:55:35Z","body":"Is fix ok? I will release then"}}