{"action":"created","issue":{"url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/17","repository_url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP","labels_url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/17/comments","events_url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/17/events","html_url":"https://github.com/liamcottle/Snapchat-SDK-PHP/issues/17","id":147871267,"number":17,"title":"Too many open files error when looping to add friends - memory leak?","user":{"login":"ellieDev","id":18429140,"avatar_url":"https://avatars.githubusercontent.com/u/18429140?v=3","gravatar_id":"","url":"https://api.github.com/users/ellieDev","html_url":"https://github.com/ellieDev","followers_url":"https://api.github.com/users/ellieDev/followers","following_url":"https://api.github.com/users/ellieDev/following{/other_user}","gists_url":"https://api.github.com/users/ellieDev/gists{/gist_id}","starred_url":"https://api.github.com/users/ellieDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ellieDev/subscriptions","organizations_url":"https://api.github.com/users/ellieDev/orgs","repos_url":"https://api.github.com/users/ellieDev/repos","events_url":"https://api.github.com/users/ellieDev/events{/privacy}","received_events_url":"https://api.github.com/users/ellieDev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-12T21:00:37Z","updated_at":"2016-04-14T21:04:47Z","closed_at":null,"body":"Getting an error after a short time looping to add friends, seems to be that somewhere there are files being opened but not closed -- heres the error text:\r\n\r\nSnapchat Request failed: [POST] [https://app.snapchat.com/bq/friend] error:02001018:system library:fopen:Too many open files\r\n\r\nCan work around it by changing the max files opened (ulimit) but that just lets it eat more and more memory, not really a solution.\r\n\r\nedit: \r\nAdditionally getting a 400 bad request error after some time (after changing the ulimit and allowing it to run for a while).  Is there a better way to add many friends simultaneously?\r\n\r\nedi2: \r\nI've changed my scripts so that no more than 5000 friends are added at a time, before the instance of the script is closed (and then a new instance opened, thus working around the memory leak).  Now I'm just getting a generic \"Snapchat Request failed: [POST] [https://app.snapchat.com/bq/friend]\" repeatedly after  the script has added a bunch of friends (actual number varies)\r\n\r\nedit3: \r\nAnother error is showing up now, and slowing down the script dramatically :-1: now failing on every request\r\nSnapchat Request failed: [POST] [https://app.snapchat.com/bq/friend] Unknown SSL protocol error in connection to app.snapchat.com:443 "},"comment":{"url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/comments/210148405","html_url":"https://github.com/liamcottle/Snapchat-SDK-PHP/issues/17#issuecomment-210148405","issue_url":"https://api.github.com/repos/liamcottle/Snapchat-SDK-PHP/issues/17","id":210148405,"user":{"login":"mzaboss","id":16923188,"avatar_url":"https://avatars.githubusercontent.com/u/16923188?v=3","gravatar_id":"","url":"https://api.github.com/users/mzaboss","html_url":"https://github.com/mzaboss","followers_url":"https://api.github.com/users/mzaboss/followers","following_url":"https://api.github.com/users/mzaboss/following{/other_user}","gists_url":"https://api.github.com/users/mzaboss/gists{/gist_id}","starred_url":"https://api.github.com/users/mzaboss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzaboss/subscriptions","organizations_url":"https://api.github.com/users/mzaboss/orgs","repos_url":"https://api.github.com/users/mzaboss/repos","events_url":"https://api.github.com/users/mzaboss/events{/privacy}","received_events_url":"https://api.github.com/users/mzaboss/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T21:04:47Z","updated_at":"2016-04-14T21:04:47Z","body":"You welcome buddy. \r\n\r\nYes, every single requests is count. \r\n\r\nI dont think so. There's anyway.. By the way.. Got skype? \r\n\r\nI need to talk to you.\r\n"}}