Skip to content
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

NullPointerException in PendingWriteQueue #3967

Closed
mingyu89 opened this issue Jul 9, 2015 · 3 comments
Closed

NullPointerException in PendingWriteQueue #3967

mingyu89 opened this issue Jul 9, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@mingyu89
Copy link

mingyu89 commented Jul 9, 2015

Netty Version: 4.0.27.final

Hi. When there're network outages, sometimes on server side we saw handler's exceptionCaught was called with a NullPointerException in PendingWriteQueue.
@trustin Is it a race condition between adding SslHandler and closing channel?
Thanks.

java.lang.NullPointerException
        at io.netty.channel.PendingWriteQueue.recycle(PendingWriteQueue.java:248) 
        at io.netty.channel.PendingWriteQueue.removeAndWrite(PendingWriteQueue.java:196) 
        at io.netty.channel.PendingWriteQueue.removeAndWriteAll(PendingWriteQueue.java:150) 
        at io.netty.handler.ssl.SslHandler.flush(SslHandler.java:455)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:735)
        at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:716)
        at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:735)
        at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:716) 
        at io.netty.channel.ChannelDuplexHandler.flush(ChannelDuplexHandler.java:117)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:735)
        at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:716)
        at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:735)
        at io.netty.channel.AbstractChannelHandlerContext.access$1500(AbstractChannelHandlerContext.java:32) 
        at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1033)
        at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:965)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
        at java.lang.Thread.run(Thread.java:745)
@normanmaurer
Copy link
Member

That's strange... let me check

@normanmaurer normanmaurer self-assigned this Jul 9, 2015
@normanmaurer normanmaurer added this to the 4.0.30.Final milestone Jul 9, 2015
@normanmaurer
Copy link
Member

@mingyu89 thanks for reporting.. I think I know what the problem is and I'm working on a fix.

@mingyu89
Copy link
Author

mingyu89 commented Jul 9, 2015

@normanmaurer Thank you!

normanmaurer added a commit that referenced this issue Jul 15, 2015
Motivation:

If the Channel is already closed when the PendingWriteQueue is created it will generate a NPE when add or remove is called later.

Modifications:

Add null checks to guard against NPE.

Result:

No more NPE possible.
normanmaurer added a commit that referenced this issue Jul 17, 2015
Motivation:

If the Channel is already closed when the PendingWriteQueue is created it will generate a NPE when add or remove is called later.

Modifications:

Add null checks to guard against NPE.

Result:

No more NPE possible.
normanmaurer added a commit that referenced this issue Jul 17, 2015
Motivation:

If the Channel is already closed when the PendingWriteQueue is created it will generate a NPE when add or remove is called later.

Modifications:

Add null checks to guard against NPE.

Result:

No more NPE possible.
normanmaurer added a commit that referenced this issue Jul 17, 2015
Motivation:

If the Channel is already closed when the PendingWriteQueue is created it will generate a NPE when add or remove is called later.

Modifications:

Add null checks to guard against NPE.

Result:

No more NPE possible.
pulllock pushed a commit to pulllock/netty that referenced this issue Oct 19, 2023
Motivation:

If the Channel is already closed when the PendingWriteQueue is created it will generate a NPE when add or remove is called later.

Modifications:

Add null checks to guard against NPE.

Result:

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

No branches or pull requests

2 participants