netty/netty — Issue #140: Channel.close() triggers NPE
Author: eugen-yakovets
Created: 2011-12-27 08:56:22+00:00
State: open

I'm getting NullPointerException when I'm closing a Channel due inactivity in heavy loaded environment.
Don't have exact steps to reproduce.

```
java.lang.NullPointerException: null
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.reset(HttpMessageDecoder.java:398) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:255) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.decodeLast(ReplayingDecoder.java:422) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:547) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(ReplayingDecoder.java:449) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360) [netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:595) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:119) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.Channels.close(Channels.java:720) [netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:200) [netty-3.2.6.Final.jar:na]
....
```
sometimes right after first NPE got another one

```
java.lang.NullPointerException: null
at org.jboss.netty.handler.codec.http.HttpHeaders.getContentLength(HttpHeaders.java:623) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:216) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:470) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282) ~[netty-3.2.6.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202) ~[netty-3.2.6.Final.jar:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
```