{"comment":{"created_at":"2011-10-24T05:48:04Z","body":"The solution is probably to not monitor. After all the websocket code uses a pool that has no maximum connection so it should probably just remove the connection from the default pool instead of moving it into a separate pool.","updated_at":"2011-10-24T05:48:04Z","url":"https://api.github.com/repos/extend/cowboy/issues/comments/2500021","id":2500021,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7d00dbf0d2c34e41b694e7ad8fafda02?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"7d00dbf0d2c34e41b694e7ad8fafda02","url":"https://api.github.com/users/essen","id":141739,"login":"essen"}},"action":"created","issue":{"number":77,"created_at":"2011-10-23T16:40:49Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"UBUNTU Version: 11.10\r\nErlang version: R14B04\r\nHEAD commit id: 66da37e30c306963a19173a1ec77a6253a9cc48d\r\n\r\nWe have a test on amazon EC2 in which we have a single server and websocket clients connecting to it at a rate of 1000 connections per sec. The clients are also running on amazon. After 340000 clients, we begin to get:\r\n\r\n```\r\n(myserv001@ip-10-17-56-75.ec2.internal)101> 16:17:38.189 [error] Supervisor cowboy_acceptors_sup had child {acceptor,<0.166.0>,79} started with cowboy_acceptor:start_link(#Port<0.4369>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'_',[{[<<\"ping\">>],myserv_healthcheck_handler,[]},{'_',myserv_websocket_handler...}]}]}...], 1024, <0.164.0>, <0.165.0>) at <0.245.0> exit with reason {timeout,{gen_server,call,[<0.164.0>,{add_connection,default,<0.10127.10>}]}} in context child_terminated\r\n16:17:56.330 [error] Supervisor cowboy_acceptors_sup had child {acceptor,<0.374.0>,93} started with cowboy_acceptor:start_link(#Port<0.4393>, cowboy_tcp_transport, myserv_http_or_flash_protocol, [{dispatch,[{'_',[{[<<\"ping\">>],myserv_healthcheck_handler,[]},{'_',myserv_websocket_handler...}]}]}...], 1024, <0.372.0>, <0.373.0>) at <0.467.0> exit with reason {timeout,{gen_server,call,[<0.372.0>,{add_connection,default,<0.10137.10>}]}} in context child_terminated\r\n16:17:56.396 [error] Supervisor cowboy_acceptors_sup had child {acceptor,<0.374.0>,95} started with cowboy_acceptor:start_link(#Port<0.4393>, cowboy_tcp_transport, myserv_http_or_flash_protocol, [{dispatch,[{'_',[{[<<\"ping\">>],myserv_healthcheck_handler,[]},{'_',myserv_websocket_handler...}]}]}...], 1024, <0.372.0>, <0.373.0>) at <0.469.0> exit with reason {timeout,{gen_server,call,[<0.372.0>,{add_connection,default,<0.10138.10>}]}} in context child_terminated\r\n16:17:56.421 [error] Supervisor cowboy_acceptors_sup had child {acceptor,<0.374.0>,20} started with cowboy_acceptor:start_link(#Port<0.4393>, cowboy_tcp_transport, myserv_http_or_flash_protocol, [{dispatch,[{'_',[{[<<\"ping\">>],myserv_healthcheck_handler,[]},{'_',myserv_websocket_handler...}]}]}...], 1024, <0.372.0>, <0.373.0>) at <0.394.0> exit with reason {timeout,{gen_server,call,[<0.372.0>,{add_connection,default,<0.10139.10>}]}} in context child_terminated\r\n16:17:56.504 [error] Supervisor cowboy_acceptors_sup had child {acceptor,<0.374.0>,73} started with cowboy_acceptor:start_link(#Port<0.4393>, cowboy_tcp_transport, myserv_http_or_flash_protocol, [{dispatch,[{'_',[{[<<\"ping\">>],myserv_healthcheck_handler,[]},{'_',myserv_websocket_handler...}]}]}...], 1024, <0.372.0>, <0.373.0>) at <0.447.0> exit with reason {timeout,{gen_server,call,[<0.372.0>,{add_connection,default,<0.10140.10>}]}} in context child_terminated\r\n16:17:56.557 [error] gen_server redis_srv terminated with reason: {timeout,{gen_server,call,[stat_srv,{global_metrics,hide}]}}\r\n16:17:56.596 [error] CRASH REPORT Process redis_srv with 1 neighbours crashed with reason: {timeout,{gen_server,call,[stat_srv,{global_metrics,hide}]}}\r\n```\r\n\r\nI think this may be a timeout in https://github.com/extend/cowboy/blob/25ae2028d6a9ce516b01f0ec126abeab00eb329d/src/cowboy_listener.erl#L90\r\n\r\nDo you have any idea what may be causing this? When running a similar test on UBUNTU 11.04 and erlang R14B03 with older cowboy revisions I was able to get about 500000 connections, now I am getting problems after ~340000.","comments":3,"title":"Cowboy has troubles handling more than ~340000 connections","updated_at":"2011-10-24T05:48:04Z","url":"https://api.github.com/repos/extend/cowboy/issues/77","id":2027383,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/58bade70e78b046f30e84483f753bc3c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"58bade70e78b046f30e84483f753bc3c","url":"https://api.github.com/users/oribrost","id":447136,"login":"oribrost"},"html_url":"https://github.com/extend/cowboy/issues/77","labels":[],"state":"open"},"legacy":{"issue_id":2027383,"comment_id":2500021}}