question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rare NullPointerException in failUnfinishedResponses

See original GitHub issue

Observed on 0.99.6: “Unexpected suppressed exception:” at HttpSessionHandler.java:402

com.linecorp.armeria.common.ClosedSessionException: null
Caused by: java.lang.NullPointerException: null
	at com.linecorp.armeria.client.HttpResponseDecoder.failUnfinishedResponses(HttpResponseDecoder.java:118)
	at com.linecorp.armeria.client.HttpSessionHandler.channelInactive(HttpSessionHandler.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:389)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.channelInactive(Http2ConnectionHandler.java:415)
	at com.linecorp.armeria.client.Http2ClientConnectionHandler.channelInactive(Http2ClientConnectionHandler.java:112)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
	at io.netty.handler.logging.LoggingHandler.channelInactive(LoggingHandler.java:197)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
	at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)
	at io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:818)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)

Not sure it if happens in latest version, but I couldn’t find any related bug report so I suppose so.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mauhizcommented, Nov 9, 2020

This happened again today (this time on Armeria 1.1.0)

com.linecorp.armeria.common.ClosedSessionException: null
Caused by: java.lang.NullPointerException: null
	at com.linecorp.armeria.client.HttpResponseDecoder.failUnfinishedResponses(HttpResponseDecoder.java:122)
	at com.linecorp.armeria.client.HttpSessionHandler.channelInactive(HttpSessionHandler.java:404)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:389)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.channelInactive(Http2ConnectionHandler.java:415)
	at com.linecorp.armeria.client.Http2ClientConnectionHandler.channelInactive(Http2ClientConnectionHandler.java:121)
0reactions
minwooxcommented, Mar 22, 2021

Not sure if IntObjectHashMap handles, when HttpResponseDecoder#failUnfinishedResponses is called, it uses iterator and it’s body block’s res#close will call HttpResponseDecoder#removeResponse and make iterator not aware the modification through IntObjectHashMap in removeResponse.

Indeed, yeah I think there’s a chance that can happen.

Maybe need to use iterator#remove manually?

Yeah, I think we need that. Could you make the change, please? 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
java - What is a NullPointerException, and how do I fix it?
NullPointerException is unusual in this respect, because it rarely has an error message. The second line is the most important one in diagnosing...
Read more >
Rare NullPointerException in com.google.android.gms ...
I got automated reports of this rare NPE on just 4 devices in 2 days, app compiled with Firebase 9.0.1: java.lang.NullPointerException: Attempt to...
Read more >
23019 – NullPointerException in RollingFileAppender when ...
WriterAppender throws in very rare cases a NullPointerException when used with an AsyncAppender. This occured during a loadtest with heavy ...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException. java lang nullpointerexception hierarchy. NullPointerException is a runtime exception, so we don't need to catch it in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found