我这边部署windows环境时,登录发现加载玩家聊天信息失败
[INFO] - io.moquette.server.netty.metrics.MessageMetricsHandler.close(MessageMetricsHandler.java:72) - channel<> closing after read 0 messages and wrote 0 messages
[INFO] - io.moquette.server.netty.metrics.BytesMetricsHandler.close(BytesMetricsHandler.java:73) - channel<> closing after read 165 bytes and wrote 0 bytes
这个是报错
String s = buffer.toString(buffer.readerIndex(), size, CharsetUtil.UTF_8);
运行到这里的时候就直接跳转到close,也就是上面的打印
MqttDecoder类的这个方法
private static Result decodeString(ByteBuf buffer, int minBytes, int maxBytes) {
int size = decodeMsbLsb(buffer);
// logUtil.info("获取的字节长度::buff:{} size:{} minBytes:{} maxBytes:{}",readUTF8(buffer),size,minBytes,maxBytes);
int numberOfBytesConsumed = 2;
if (size < minBytes || size > maxBytes) {
logUtil.info("解析长度数据出错");
buffer.skipBytes(size);
numberOfBytesConsumed += size;
return new Result(null, numberOfBytesConsumed);
}
logUtil.info("可以解析出长度");
String s = buffer.toString(buffer.readerIndex(), size, CharsetUtil.UTF_8);
logUtil.info("解析出来的数据:::{}",s);
buffer.skipBytes(size);
numberOfBytesConsumed += size;
// logUtil.info("decodeString numberOfBytesConsumed={}",numberOfBytesConsumed+"",new Throwable());
return new Result(s, numberOfBytesConsumed);
}
2023-12-09 10:05:46 INFO 《 io.netty.handler.codec.mqtt.MqttDecoder》 decodeConnectionVariableHeader 285 开始解析数据了::
io.netty.handler.codec.mqtt.MqttDecoder/MqttDecoder.java/285/decodeConnectionVariableHeader
io.netty.handler.codec.mqtt.MqttDecoder/MqttDecoder.java/248/decodeVariableHeader
io.netty.handler.codec.mqtt.MqttDecoder/MqttDecoder.java/89/decode
io.netty.handler.codec.ByteToMessageDecoder/ByteToMessageDecoder.java/507/decodeRemovalReentryProtection
io.netty.handler.codec.ByteToMessageDecoder/ByteToMessageDecoder.java/530/decodeLast
io.netty.handler.codec.ReplayingDecoder/ReplayingDecoder.java/333/channelInputClosed
io.netty.handler.codec.ByteToMessageDecoder/ByteToMessageDecoder.java/371/channelInputClosed
io.netty.handler.codec.ByteToMessageDecoder/ByteToMessageDecoder.java/354/channelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/262/invokeChannelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/248/invokeChannelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/241/fireChannelInactive
io.netty.channel.ChannelInboundHandlerAdapter/ChannelInboundHandlerAdapter.java/81/channelInactive
io.netty.handler.timeout.IdleStateHandler/IdleStateHandler.java/277/channelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/262/invokeChannelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/248/invokeChannelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/241/fireChannelInactive
io.netty.channel.DefaultChannelPipeline$HeadContext/DefaultChannelPipeline.java/1405/channelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/262/invokeChannelInactive
io.netty.channel.AbstractChannelHandlerContext/AbstractChannelHandlerContext.java/248/invokeChannelInactive
io.netty.channel.DefaultChannelPipeline/DefaultChannelPipeline.java/901/fireChannelInactive
io.netty.channel.AbstractChannel$AbstractUnsafe$8/AbstractChannel.java/831/run
io.netty.util.concurrent.AbstractEventExecutor/AbstractEventExecutor.java/164/safeExecute
io.netty.util.concurrent.SingleThreadEventExecutor/SingleThreadEventExecutor.java/469/runAllTasks
io.netty.channel.nio.NioEventLoop/NioEventLoop.java/497/run
io.netty.util.concurrent.SingleThreadEventExecutor$4/SingleThreadEventExecutor.java/986/run
io.netty.util.internal.ThreadExecutorMap$2/ThreadExecutorMap.java/74/run
io.netty.util.concurrent.FastThreadLocalRunnable/FastThreadLocalRunnable.java/30/run
java.lang.Thread/Thread.java/748/run
可以解析出长度
[10:05:46:976] [INFO] - io.moquette.server.netty.metrics.MessageMetricsHandler.close(MessageMetricsHandler.java:72) - channel<> closing after read 0 messages and wrote 0 messages
[10:05:46:976] [INFO] - io.moquette.server.netty.metrics.BytesMetricsHandler.close(BytesMetricsHandler.java:73) - channel<> closing after read 165 bytes and wrote 0 bytes
这个是我的打印