{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/io.js/issues/1936","labels_url":"https://api.github.com/repos/nodejs/io.js/issues/1936/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/io.js/issues/1936/comments","events_url":"https://api.github.com/repos/nodejs/io.js/issues/1936/events","html_url":"https://github.com/nodejs/io.js/pull/1936","id":86912695,"number":1936,"title":"net: Fixing error message","user":{"login":"thefourtheye","id":696611,"avatar_url":"https://avatars.githubusercontent.com/u/696611?v=3","gravatar_id":"","url":"https://api.github.com/users/thefourtheye","html_url":"https://github.com/thefourtheye","followers_url":"https://api.github.com/users/thefourtheye/followers","following_url":"https://api.github.com/users/thefourtheye/following{/other_user}","gists_url":"https://api.github.com/users/thefourtheye/gists{/gist_id}","starred_url":"https://api.github.com/users/thefourtheye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thefourtheye/subscriptions","organizations_url":"https://api.github.com/users/thefourtheye/orgs","repos_url":"https://api.github.com/users/thefourtheye/repos","events_url":"https://api.github.com/users/thefourtheye/events{/privacy}","received_events_url":"https://api.github.com/users/thefourtheye/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/io.js/labels/net","name":"net","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-10T10:07:12Z","updated_at":"2015-06-10T15:09:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/1936","html_url":"https://github.com/nodejs/io.js/pull/1936","diff_url":"https://github.com/nodejs/io.js/pull/1936.diff","patch_url":"https://github.com/nodejs/io.js/pull/1936.patch"},"body":"When I was trying to understand the problem in https://github.com/nodejs/io.js/issues/1924, I found out that we show error messages like this\r\n\r\n    Error: connect EMFILE 127.0.0.1:8888 - Local (undefined:undefined)\r\n\r\nIt is because, we ran out of file descriptors and we don't have a valid socket. So, if the return value of `_getsockname` doesn't have valid `address` and `port` properties, we just don't include them in the error message.\r\n\r\n---\r\n\r\nThe problem can be reproduced with the following code\r\n\r\n    var net = require('net');\r\n\r\n    // Server\r\n    net.createServer().listen(8888, function () {\r\n        console.log('server bound');\r\n    });\r\n\r\n    console.log('Launched');\r\n\r\n    // Connect to server\r\n    for (var i = 0; i < 10000; i++) {\r\n        net.connect({\r\n            port: 8888\r\n        });\r\n    }\r\n\r\ncc: @bnoordhuis "},"comment":{"url":"https://api.github.com/repos/nodejs/io.js/issues/comments/110789899","html_url":"https://github.com/nodejs/io.js/pull/1936#issuecomment-110789899","issue_url":"https://api.github.com/repos/nodejs/io.js/issues/1936","id":110789899,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T15:09:55Z","updated_at":"2015-06-10T15:09:55Z","body":"@thefourtheye Can you add a small regression test?  test/sequential/test-child-process-emfile.js is an example of how you can (deliberately) hit the EMFILE limit in a test."}}