{"action":"created","issue":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1180","repository_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1180/labels{/name}","comments_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1180/comments","events_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1180/events","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/1180","id":158729472,"number":1180,"title":"o.a.n.r.NettyRequestSender$1.operationComplete() java.lang.NullPointerException: timeoutsHolder","user":{"login":"Spikhalskiy","id":532108,"avatar_url":"https://avatars.githubusercontent.com/u/532108?v=3","gravatar_id":"","url":"https://api.github.com/users/Spikhalskiy","html_url":"https://github.com/Spikhalskiy","followers_url":"https://api.github.com/users/Spikhalskiy/followers","following_url":"https://api.github.com/users/Spikhalskiy/following{/other_user}","gists_url":"https://api.github.com/users/Spikhalskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/Spikhalskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spikhalskiy/subscriptions","organizations_url":"https://api.github.com/users/Spikhalskiy/orgs","repos_url":"https://api.github.com/users/Spikhalskiy/repos","events_url":"https://api.github.com/users/Spikhalskiy/events{/privacy}","received_events_url":"https://api.github.com/users/Spikhalskiy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-06T17:19:27Z","updated_at":"2016-06-06T18:28:12Z","closed_at":null,"body":"Hi,\r\n\r\nI'm getting the following exception with AsyncHttpClient sporadically\r\n\r\n```\r\n[06 Jun 2016 13:02:35,198][WARN ][DefaultPromise,collectedRequestDisruptor73689328] - An exception was thrown by org.asynchttpclient.netty.request.NettyRequestSender$1.operationComplete()\r\njava.lang.NullPointerException: timeoutsHolder\r\n\tat org.asynchttpclient.util.Assertions.assertNotNull(Assertions.java:23)\r\n\tat org.asynchttpclient.netty.request.NettyChannelConnector.<init>(NettyChannelConnector.java:54)\r\n\tat org.asynchttpclient.netty.request.NettyRequestSender$1.onSuccess(NettyRequestSender.java:281)\r\n\tat org.asynchttpclient.netty.request.NettyRequestSender$1.onSuccess(NettyRequestSender.java:276)\r\n\tat org.asynchttpclient.netty.SimpleFutureListener.operationComplete(SimpleFutureListener.java:24)\r\n\tat io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:683)\r\n\tat io.netty.util.concurrent.DefaultPromise.notifyLateListener(DefaultPromise.java:624)\r\n\tat io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:139)\r\n\tat io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:33)\r\n\tat org.asynchttpclient.netty.request.NettyRequestSender.sendRequestWithNewChannel(NettyRequestSender.java:276)\r\n\tat org.asynchttpclient.netty.request.NettyRequestSender.sendRequestWithCertainForceConnect(NettyRequestSender.java:136)\r\n\tat org.asynchttpclient.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:107)\r\n\tat org.asynchttpclient.DefaultAsyncHttpClient.execute(DefaultAsyncHttpClient.java:220)\r\n\tat org.asynchttpclient.DefaultAsyncHttpClient.executeRequest(DefaultAsyncHttpClient.java:188)\r\n\tat org.asynchttpclient.BoundRequestBuilder.execute(BoundRequestBuilder.java:35)\r\n        ...\r\n```\r\n\r\nVersion: 2.0.4\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/comments/224045717","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/1180#issuecomment-224045717","issue_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1180","id":224045717,"user":{"login":"Spikhalskiy","id":532108,"avatar_url":"https://avatars.githubusercontent.com/u/532108?v=3","gravatar_id":"","url":"https://api.github.com/users/Spikhalskiy","html_url":"https://github.com/Spikhalskiy","followers_url":"https://api.github.com/users/Spikhalskiy/followers","following_url":"https://api.github.com/users/Spikhalskiy/following{/other_user}","gists_url":"https://api.github.com/users/Spikhalskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/Spikhalskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spikhalskiy/subscriptions","organizations_url":"https://api.github.com/users/Spikhalskiy/orgs","repos_url":"https://api.github.com/users/Spikhalskiy/repos","events_url":"https://api.github.com/users/Spikhalskiy/events{/privacy}","received_events_url":"https://api.github.com/users/Spikhalskiy/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T18:28:12Z","updated_at":"2016-06-06T18:28:12Z","body":"About Leak - I'm not sure it's useful to put here full output, but I analyzed it and what I found. I have class\r\n\r\n```\r\npublic class ReleasingByteBufInputStream extends ByteBufInputStream {\r\n    private ByteBuf buffer;\r\n\r\n    public ReleasingByteBufInputStream(ByteBuf buffer) {\r\n        super(buffer);\r\n        ReferenceCountUtil.retain(buffer);\r\n        this.buffer = buffer;\r\n    }\r\n\r\n    @Override\r\n    public void close() throws IOException {\r\n        super.close();\r\n        ReferenceCountUtil.release(buffer);\r\n        buffer = null; //to make close idempotent\r\n    }\r\n}\r\n```\r\n\r\nWhich I use this way:\r\n\r\n```\r\n    public void onEvent(CollectedEvent event, long sequence, boolean endOfBatch) throws Exception {\r\n        try {\r\n            if (event.isSend()) {\r\n                send(event);\r\n            }\r\n        } finally {\r\n            ReferenceCountUtil.release(event.getFullHttpRequest());\r\n        }\r\n    }\r\n\r\n    private void send(CollectedEvent event) {\r\n        httpClient.preparePost(endpointUrl)\r\n                .setHeaders(adoptHeaders(fullHttpRequest.headers()))\r\n                .setBody(new ReleasingByteBufInputStream(fullHttpRequest.content()))\r\n                .execute(handler);\r\n    }\r\n```\r\nAnd there is no call to ReferenceCountUtil.release from ReleasingByteBufInputStream#close() in netty's log. So, looks like, in some cases AsyncHttpClient doesn't call close on passed input stream. Could be related to subj problem."}}
{"actor":{"display_login":"Spikhalskiy"}}