{"action":"created","issue":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/831","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/831/labels{/name}","comments_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/831/comments","events_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/831/events","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/831","id":59106012,"number":831,"title":"freeChannels isn't being released (Netty)","user":{"login":"marenzo","id":1208453,"avatar_url":"https://avatars.githubusercontent.com/u/1208453?v=3","gravatar_id":"","url":"https://api.github.com/users/marenzo","html_url":"https://github.com/marenzo","followers_url":"https://api.github.com/users/marenzo/followers","following_url":"https://api.github.com/users/marenzo/following{/other_user}","gists_url":"https://api.github.com/users/marenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/marenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marenzo/subscriptions","organizations_url":"https://api.github.com/users/marenzo/orgs","repos_url":"https://api.github.com/users/marenzo/repos","events_url":"https://api.github.com/users/marenzo/events{/privacy}","received_events_url":"https://api.github.com/users/marenzo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-26T17:18:26Z","updated_at":"2015-02-26T17:27:34Z","closed_at":"2015-02-26T17:27:34Z","body":"For some reason, the following code:\r\n\r\n```java\r\n    AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setMaxConnections(200).setMaxConnectionsPerHost(100).build();\r\n    AsyncHttpClient asyncHttpClient = new AsyncHttpClient(config);\r\n    for (int i = 0; i < 140; i++) {\r\n      asyncHttpClient.prepareGet(\"http://localhost/page.html\").execute(new AsyncCompletionHandler<Response>(){\r\n\r\n        @Override\r\n        public Response onCompleted(Response response) throws Exception{\r\n          System.out.println(\"Completed\");\r\n          return response;\r\n        }\r\n\r\n        @Override\r\n        public void onThrowable(Throwable t){\r\n          System.out.println(t.getMessage());\r\n        }\r\n      }).get();\r\n    }\r\n```\r\nWill throw the following exception: `java.io.IOException: Too many connections per host 100`\r\n\r\nAs its seems, `abortChannelPreemption` (in `NettyConnectListener`) is never being called because the condition `if (future.isDone())` is always false, thus `freeChannels` (`ChannelManager`) never being released.\r\n\r\nHappens on AHC 1.9.10, Java version \"1.7.0_65\"."},"comment":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/comments/76223344","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/831#issuecomment-76223344","issue_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/831","id":76223344,"user":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T17:27:34Z","updated_at":"2015-02-26T17:27:34Z","body":"Please upgrade to 1.9.11: #820"}}