lizhanhui / moquette-mqtt

Automatically exported from code.google.com/p/moquette-mqtt
Apache License 2.0
0 stars 0 forks source link

java.lang.NullPointerException every 10s #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Revision: 27c5d758718

After starting the server, I get a NullPointerException every 10s.

27029 [nioEventLoopGroup-3-1] WARN  DefaultChannelPipeline  - An 
exceptionCaught() event was fired, and it reached at the tail of the pipeline. 
It usually means the last handler in the pipeline did not handle the exception.
java.lang.NullPointerException
        at org.dna.mqtt.moquette.server.netty.NettyMQTTHandler.channelInactive(NettyMQTTHandler.java:81)

The IdleStateHandler is set to 10s from the beginning. Then if a connection 
comes in, it is removed and newly set with the mqtt timeout. Why is it there 
from the beginning? Without connection there is no NettyChannel, so 
m_channelMapper.get(ctx) returns null.

Best regards,
Mike

Original issue reported on code.google.com by mightyfo...@googlemail.com on 5 Sep 2014 at 5:31

GoogleCodeExporter commented 9 years ago
It is not a real bug, the server could probably be a little bit more robust. 
The 10s were misleading for me. The following is the case: I am testing behind 
a loadbalancer which checks every 10s if the host is reachable on a specific 
port. Didn't know that until now and unfortunately both time intervals are 10s 
;-). However, the mqtt server can't handle a pure TCP handshake because the 
channelRead() method is never called. But once the TCP connection breaks down 
with ACK, FIN the channelInactive() method is called. And there the 
NettyChannel is null, because channelRead() never got called. I will help 
myself by checking the NettyChannel for null in channelInactive().

Original comment by mightyfo...@googlemail.com on 5 Sep 2014 at 11:36

GoogleCodeExporter commented 9 years ago
I close the issue because is not related directly to the broker itself but with 
the networking configuration.

Original comment by selva.an...@gmail.com on 9 Sep 2014 at 9:46