{"action":"created","comment":{"url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/comments/45069128","id":45069128,"diff_hunk":"@@ -136,6 +136,40 @@ var Papertrail = exports.Papertrail = function (options) {\n     // Open the connection\n     connectStream();\n \n+    function cleanup() {\n+        self._erroring = true;\n+        try {\n+            if (self.socket) {\n+                self.socket.destroy();\n+\n+                //this throws some uncatchable thing, eww.\n+                //self.socket.end();\n+                self.socket = null;\n+            }\n+        }\n+        catch (e) { }","path":"lib/winston-papertrail.js","position":15,"original_position":15,"commit_id":"44832bbfefc3f428de91ef5570b4182869d5be0a","original_commit_id":"44832bbfefc3f428de91ef5570b4182869d5be0a","user":{"login":"kenperkins","id":730664,"avatar_url":"https://avatars.githubusercontent.com/u/730664?v=3","gravatar_id":"","url":"https://api.github.com/users/kenperkins","html_url":"https://github.com/kenperkins","followers_url":"https://api.github.com/users/kenperkins/followers","following_url":"https://api.github.com/users/kenperkins/following{/other_user}","gists_url":"https://api.github.com/users/kenperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/kenperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenperkins/subscriptions","organizations_url":"https://api.github.com/users/kenperkins/orgs","repos_url":"https://api.github.com/users/kenperkins/repos","events_url":"https://api.github.com/users/kenperkins/events{/privacy}","received_events_url":"https://api.github.com/users/kenperkins/received_events","type":"User","site_admin":false},"body":"That's what I was wondering; is there value in `self.emit(e)`? Not being super familiar with when `socket.destroy()` throws I'm speculating.","created_at":"2015-11-17T15:00:08Z","updated_at":"2015-11-17T15:00:08Z","html_url":"https://github.com/kenperkins/winston-papertrail/pull/46#discussion_r45069128","pull_request_url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/comments/45069128"},"html":{"href":"https://github.com/kenperkins/winston-papertrail/pull/46#discussion_r45069128"},"pull_request":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46","id":49182228,"html_url":"https://github.com/kenperkins/winston-papertrail/pull/46","diff_url":"https://github.com/kenperkins/winston-papertrail/pull/46.diff","patch_url":"https://github.com/kenperkins/winston-papertrail/pull/46.patch","issue_url":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/46","number":46,"state":"open","locked":false,"title":"Cleanup sockets when creating new connections","user":{"login":"dmiddlecamp","id":833793,"avatar_url":"https://avatars.githubusercontent.com/u/833793?v=3","gravatar_id":"","url":"https://api.github.com/users/dmiddlecamp","html_url":"https://github.com/dmiddlecamp","followers_url":"https://api.github.com/users/dmiddlecamp/followers","following_url":"https://api.github.com/users/dmiddlecamp/following{/other_user}","gists_url":"https://api.github.com/users/dmiddlecamp/gists{/gist_id}","starred_url":"https://api.github.com/users/dmiddlecamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmiddlecamp/subscriptions","organizations_url":"https://api.github.com/users/dmiddlecamp/orgs","repos_url":"https://api.github.com/users/dmiddlecamp/repos","events_url":"https://api.github.com/users/dmiddlecamp/events{/privacy}","received_events_url":"https://api.github.com/users/dmiddlecamp/received_events","type":"User","site_admin":false},"body":"We noticed a bug where many thousands of simultaneous connections can be leaked.  This closes sockets and also prevents uncatchable exceptions from being thrown when many quick connection attempts are made in a short period of time.","created_at":"2015-10-29T18:40:39Z","updated_at":"2015-11-17T15:00:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50eb25536e5900b011b38c158a26c03868186c93","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46/commits","review_comments_url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46/comments","review_comment_url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/46/comments","statuses_url":"https://api.github.com/repos/kenperkins/winston-papertrail/statuses/44832bbfefc3f428de91ef5570b4182869d5be0a","head":{"label":"spark:master","ref":"master","sha":"44832bbfefc3f428de91ef5570b4182869d5be0a","user":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"repo":{"id":39535427,"name":"winston-papertrail","full_name":"spark/winston-papertrail","owner":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spark/winston-papertrail","description":"Papertrail transport for Winston","fork":true,"url":"https://api.github.com/repos/spark/winston-papertrail","forks_url":"https://api.github.com/repos/spark/winston-papertrail/forks","keys_url":"https://api.github.com/repos/spark/winston-papertrail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spark/winston-papertrail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spark/winston-papertrail/teams","hooks_url":"https://api.github.com/repos/spark/winston-papertrail/hooks","issue_events_url":"https://api.github.com/repos/spark/winston-papertrail/issues/events{/number}","events_url":"https://api.github.com/repos/spark/winston-papertrail/events","assignees_url":"https://api.github.com/repos/spark/winston-papertrail/assignees{/user}","branches_url":"https://api.github.com/repos/spark/winston-papertrail/branches{/branch}","tags_url":"https://api.github.com/repos/spark/winston-papertrail/tags","blobs_url":"https://api.github.com/repos/spark/winston-papertrail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spark/winston-papertrail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spark/winston-papertrail/git/refs{/sha}","trees_url":"https://api.github.com/repos/spark/winston-papertrail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spark/winston-papertrail/statuses/{sha}","languages_url":"https://api.github.com/repos/spark/winston-papertrail/languages","stargazers_url":"https://api.github.com/repos/spark/winston-papertrail/stargazers","contributors_url":"https://api.github.com/repos/spark/winston-papertrail/contributors","subscribers_url":"https://api.github.com/repos/spark/winston-papertrail/subscribers","subscription_url":"https://api.github.com/repos/spark/winston-papertrail/subscription","commits_url":"https://api.github.com/repos/spark/winston-papertrail/commits{/sha}","git_commits_url":"https://api.github.com/repos/spark/winston-papertrail/git/commits{/sha}","comments_url":"https://api.github.com/repos/spark/winston-papertrail/comments{/number}","issue_comment_url":"https://api.github.com/repos/spark/winston-papertrail/issues/comments{/number}","contents_url":"https://api.github.com/repos/spark/winston-papertrail/contents/{+path}","compare_url":"https://api.github.com/repos/spark/winston-papertrail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spark/winston-papertrail/merges","archive_url":"https://api.github.com/repos/spark/winston-papertrail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spark/winston-papertrail/downloads","issues_url":"https://api.github.com/repos/spark/winston-papertrail/issues{/number}","pulls_url":"https://api.github.com/repos/spark/winston-papertrail/pulls{/number}","milestones_url":"https://api.github.com/repos/spark/winston-papertrail/milestones{/number}","notifications_url":"https://api.github.com/repos/spark/winston-papertrail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spark/winston-papertrail/labels{/name}","releases_url":"https://api.github.com/repos/spark/winston-papertrail/releases{/id}","created_at":"2015-07-22T23:38:21Z","updated_at":"2015-07-22T23:38:21Z","pushed_at":"2015-10-21T23:31:48Z","git_url":"git://github.com/spark/winston-papertrail.git","ssh_url":"git@github.com:spark/winston-papertrail.git","clone_url":"https://github.com/spark/winston-papertrail.git","svn_url":"https://github.com/spark/winston-papertrail","homepage":"","size":175,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kenperkins:master","ref":"master","sha":"5de6f637be87adb4251b10ed1ee9871b6b55c1a6","user":{"login":"kenperkins","id":730664,"avatar_url":"https://avatars.githubusercontent.com/u/730664?v=3","gravatar_id":"","url":"https://api.github.com/users/kenperkins","html_url":"https://github.com/kenperkins","followers_url":"https://api.github.com/users/kenperkins/followers","following_url":"https://api.github.com/users/kenperkins/following{/other_user}","gists_url":"https://api.github.com/users/kenperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/kenperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenperkins/subscriptions","organizations_url":"https://api.github.com/users/kenperkins/orgs","repos_url":"https://api.github.com/users/kenperkins/repos","events_url":"https://api.github.com/users/kenperkins/events{/privacy}","received_events_url":"https://api.github.com/users/kenperkins/received_events","type":"User","site_admin":false},"repo":{"id":3996064,"name":"winston-papertrail","full_name":"kenperkins/winston-papertrail","owner":{"login":"kenperkins","id":730664,"avatar_url":"https://avatars.githubusercontent.com/u/730664?v=3","gravatar_id":"","url":"https://api.github.com/users/kenperkins","html_url":"https://github.com/kenperkins","followers_url":"https://api.github.com/users/kenperkins/followers","following_url":"https://api.github.com/users/kenperkins/following{/other_user}","gists_url":"https://api.github.com/users/kenperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/kenperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenperkins/subscriptions","organizations_url":"https://api.github.com/users/kenperkins/orgs","repos_url":"https://api.github.com/users/kenperkins/repos","events_url":"https://api.github.com/users/kenperkins/events{/privacy}","received_events_url":"https://api.github.com/users/kenperkins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kenperkins/winston-papertrail","description":"Papertrail transport for Winston","fork":false,"url":"https://api.github.com/repos/kenperkins/winston-papertrail","forks_url":"https://api.github.com/repos/kenperkins/winston-papertrail/forks","keys_url":"https://api.github.com/repos/kenperkins/winston-papertrail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kenperkins/winston-papertrail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kenperkins/winston-papertrail/teams","hooks_url":"https://api.github.com/repos/kenperkins/winston-papertrail/hooks","issue_events_url":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/events{/number}","events_url":"https://api.github.com/repos/kenperkins/winston-papertrail/events","assignees_url":"https://api.github.com/repos/kenperkins/winston-papertrail/assignees{/user}","branches_url":"https://api.github.com/repos/kenperkins/winston-papertrail/branches{/branch}","tags_url":"https://api.github.com/repos/kenperkins/winston-papertrail/tags","blobs_url":"https://api.github.com/repos/kenperkins/winston-papertrail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kenperkins/winston-papertrail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kenperkins/winston-papertrail/git/refs{/sha}","trees_url":"https://api.github.com/repos/kenperkins/winston-papertrail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kenperkins/winston-papertrail/statuses/{sha}","languages_url":"https://api.github.com/repos/kenperkins/winston-papertrail/languages","stargazers_url":"https://api.github.com/repos/kenperkins/winston-papertrail/stargazers","contributors_url":"https://api.github.com/repos/kenperkins/winston-papertrail/contributors","subscribers_url":"https://api.github.com/repos/kenperkins/winston-papertrail/subscribers","subscription_url":"https://api.github.com/repos/kenperkins/winston-papertrail/subscription","commits_url":"https://api.github.com/repos/kenperkins/winston-papertrail/commits{/sha}","git_commits_url":"https://api.github.com/repos/kenperkins/winston-papertrail/git/commits{/sha}","comments_url":"https://api.github.com/repos/kenperkins/winston-papertrail/comments{/number}","issue_comment_url":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/comments{/number}","contents_url":"https://api.github.com/repos/kenperkins/winston-papertrail/contents/{+path}","compare_url":"https://api.github.com/repos/kenperkins/winston-papertrail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kenperkins/winston-papertrail/merges","archive_url":"https://api.github.com/repos/kenperkins/winston-papertrail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kenperkins/winston-papertrail/downloads","issues_url":"https://api.github.com/repos/kenperkins/winston-papertrail/issues{/number}","pulls_url":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls{/number}","milestones_url":"https://api.github.com/repos/kenperkins/winston-papertrail/milestones{/number}","notifications_url":"https://api.github.com/repos/kenperkins/winston-papertrail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kenperkins/winston-papertrail/labels{/name}","releases_url":"https://api.github.com/repos/kenperkins/winston-papertrail/releases{/id}","created_at":"2012-04-11T17:20:58Z","updated_at":"2015-11-13T20:33:34Z","pushed_at":"2015-11-13T20:35:11Z","git_url":"git://github.com/kenperkins/winston-papertrail.git","ssh_url":"git@github.com:kenperkins/winston-papertrail.git","clone_url":"https://github.com/kenperkins/winston-papertrail.git","svn_url":"https://github.com/kenperkins/winston-papertrail","homepage":"","size":504,"stargazers_count":82,"watchers_count":82,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":13,"forks":30,"open_issues":13,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46"},"html":{"href":"https://github.com/kenperkins/winston-papertrail/pull/46"},"issue":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/46"},"comments":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/kenperkins/winston-papertrail/statuses/44832bbfefc3f428de91ef5570b4182869d5be0a"}}}}