AsyncHttpClient/async-http-client

NPE in at org.asynchttpclient.netty.channel.Channels.setAttribute(Channels.java:36)

xiaoawo opened this issue · 6 comments

java.lang.NullPointerException
at org.asynchttpclient.netty.channel.Channels.setAttribute(Channels.java:36)
at org.asynchttpclient.netty.channel.Channels.setDiscard(Channels.java:40)
at org.asynchttpclient.netty.NettyResponseFuture.cancel(NettyResponseFuture.java:183)

I noticed that in the done() and abort() methods, the channel is set to null. If the code at line 182 (channel != null) is executed at this time, and another thread executes done() or abort(), it may lead to a NullPointerException at org.asynchttpclient.netty.channel.Channels.setAttribute(Channels.java:36).

This is likely a race condition. Do you plan for a PR?

This is likely a race condition. Do you plan for a PR?

yes,I will handle it in the next two days and provide a PR.