Skip to content

NPE in Channels.getAttribute() method #1779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
doom369 opened this issue Mar 15, 2021 · 3 comments
Closed

NPE in Channels.getAttribute() method #1779

doom369 opened this issue Mar 15, 2021 · 3 comments

Comments

@doom369
Copy link
Contributor

doom369 commented Mar 15, 2021

Latest async verison:

java.lang.NullPointerException: null
        at org.asynchttpclient.netty.channel.Channels.getAttribute(Channels.java:31) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at org.asynchttpclient.netty.request.NettyRequestSender.abort(NettyRequestSender.java:467) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.exceptionCaught(AsyncHttpClientHandler.java:201) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:273) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireExceptionCaught(CombinedChannelDuplexHandler.java:424) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.ChannelHandlerAdapter.exceptionCaught(ChannelHandlerAdapter.java:92) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler$1.fireExceptionCaught(CombinedChannelDuplexHandler.java:145) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:143) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler.exceptionCaught(CombinedChannelDuplexHandler.java:231) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:273) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.handler.ssl.SslHandler.exceptionCaught(SslHandler.java:1152) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:273) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.exceptionCaught(DefaultChannelPipeline.java:1377) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.DefaultChannelPipeline.fireExceptionCaught(DefaultChannelPipeline.java:907) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.handleReadException(AbstractEpollStreamChannel.java:728) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:821) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[xxx-0.70.2-SNAPSHOT-1,609.jar:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

@doom369
Copy link
Contributor Author

doom369 commented Mar 15, 2021

@TomGranot most likely this is a typo in NettyRequestSender.abort.

Now:

if (channel != null) {
  Object attribute = Channels.getAttribute(future.channel());
  if (attribute instanceof StreamedResponsePublisher) {
    ((StreamedResponsePublisher) attribute).setError(t);
  }

Should be:

if (channel != null) {
  Object attribute = Channels.getAttribute(channel);
  if (attribute instanceof StreamedResponsePublisher) {
    ((StreamedResponsePublisher) attribute).setError(t);
  }

@doom369
Copy link
Contributor Author

doom369 commented Mar 15, 2021

Looks like a duplicate of #1769
@TomGranot could you please merge the related PR.

@TomGranot
Copy link
Contributor

Fixed by #1771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants