moquette
moquette copied to clipboard
The server throws an exception when the message is received
Expected behavior
The server can receive messages
Actual behavior
io.netty.channel.DefaultChannelPipeline(151) - 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.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) at io.moquette.spi.DurableSession.enqueue(DurableSession.java:191) at io.moquette.spi.impl.MessagesPublisher.publish2Subscribers(MessagesPublisher.java:109) at io.moquette.spi.impl.Qos0PublishHandler.receivedPublishQos0(Qos0PublishHandler.java:59) at io.moquette.spi.impl.ProtocolProcessor.processPublish(ProtocolProcessor.java:457) at io.moquette.server.netty.NettyMQTTHandler.channelRead(NettyMQTTHandler.java:58)
Steps to reproduce
The service runs a few days later
Minimal yet complete reproducer code (or URL to code) or complete log file
Moquette MQTT version
0.11
JVM version (e.g. java -version)
jdk 1.8
OS version (e.g. uname -a)
CentOS Linux release 7.4.1708 (Core)
you maybe send too much message at a short time,so StoredMessage's Queue is full and throw exception
After throwing an exception, all the recipients will throw this exception.How to solve it
two methods:
-
just change MAX_MESSAGE_QUEUE's value in package io.moquette.server's Constants.java ,default value is 1024,but it may be not work well;
-
Implements ISessionsStore, ISubscriptionsStore and define your own SessionStore than change the way to store StoredMessage(system default user ArrayBlockingQueue to store StoredMessage and max length is 1024,more info you can see and refer MemorySessionStore.java)。
(Forgive my poor English,I hope you can understand)