{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/etcd/issues/3219","labels_url":"https://api.github.com/repos/coreos/etcd/issues/3219/labels{/name}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/3219/comments","events_url":"https://api.github.com/repos/coreos/etcd/issues/3219/events","html_url":"https://github.com/coreos/etcd/pull/3219","id":99050052,"number":3219,"title":"etcdmain: stop accepting client conns when it reachs limit","user":{"login":"yichengq","id":2976232,"avatar_url":"https://avatars.githubusercontent.com/u/2976232?v=3","gravatar_id":"","url":"https://api.github.com/users/yichengq","html_url":"https://github.com/yichengq","followers_url":"https://api.github.com/users/yichengq/followers","following_url":"https://api.github.com/users/yichengq/following{/other_user}","gists_url":"https://api.github.com/users/yichengq/gists{/gist_id}","starred_url":"https://api.github.com/users/yichengq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yichengq/subscriptions","organizations_url":"https://api.github.com/users/yichengq/orgs","repos_url":"https://api.github.com/users/yichengq/repos","events_url":"https://api.github.com/users/yichengq/events{/privacy}","received_events_url":"https://api.github.com/users/yichengq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-04T20:02:42Z","updated_at":"2015-08-05T21:59:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/3219","html_url":"https://github.com/coreos/etcd/pull/3219","diff_url":"https://github.com/coreos/etcd/pull/3219.diff","patch_url":"https://github.com/coreos/etcd/pull/3219.patch"},"body":"This solves the problem that etcd may fatal because its critical path\r\ncannot get file descriptor resource when the number of clients is too\r\nbig. The PR lets the client listener stop accepting connections when\r\nthe file descriptor usage in the process reaches some pre-set limit, so\r\nit ensures that the internal critical path could always get file\r\ndescriptor when it needs.\r\n\r\nClient which arrives after the listener hits the limit is queued at the\r\nkernel. For more details, you could check `man listen`.\r\n\r\nWhen there are tons to clients connecting to the server, the original\r\nbehavior is like this:\r\n\r\n```\r\n2015/08/4 16:42:08 etcdserver: cannot monitor file descriptor usage\r\n(open /proc/self/fd: too many open files)\r\n2015/08/4 16:42:33 etcdserver: failed to purge snap file open\r\ndefault2.etcd/member/snap: too many open files\r\n[halted]\r\n```\r\n\r\nCurrent behavior is like this:\r\n\r\n```\r\n2015/08/4 17:39:29 etcdserver: 80% of the file descriptor limit is used\r\n[used = 974, limit = 1024]\r\n```\r\n\r\nIt is available at linux system today because pkg/runtime only has linux\r\nsupport.\r\n\r\nfixes #2477 "},"comment":{"url":"https://api.github.com/repos/coreos/etcd/issues/comments/128162223","html_url":"https://github.com/coreos/etcd/pull/3219#issuecomment-128162223","issue_url":"https://api.github.com/repos/coreos/etcd/issues/3219","id":128162223,"user":{"login":"yichengq","id":2976232,"avatar_url":"https://avatars.githubusercontent.com/u/2976232?v=3","gravatar_id":"","url":"https://api.github.com/users/yichengq","html_url":"https://github.com/yichengq","followers_url":"https://api.github.com/users/yichengq/followers","following_url":"https://api.github.com/users/yichengq/following{/other_user}","gists_url":"https://api.github.com/users/yichengq/gists{/gist_id}","starred_url":"https://api.github.com/users/yichengq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yichengq/subscriptions","organizations_url":"https://api.github.com/users/yichengq/orgs","repos_url":"https://api.github.com/users/yichengq/repos","events_url":"https://api.github.com/users/yichengq/events{/privacy}","received_events_url":"https://api.github.com/users/yichengq/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T21:59:08Z","updated_at":"2015-08-05T21:59:08Z","body":"Change the behavior to reject connections directly. PTAL"}}