前一阵子刚整理完RocketMQ4.3.x版本的相关配置的工作,接下来就来测试一下改变参数会带来什么好的结果

首先我就选中了useEpollNativeSelector 这个参数

默认这个参数是 false

这个参数的意思就是是否启用Epoll IO模型。Linux环境建议开启


然后我就打开了这个参数试试看看会不会生效

首先是namesrv 弄了一个配置文件指向启动

然后启动namesrv

sh bin/mqnamesrv -c conf/namesrv.conf

很不幸抛出了一个异常

java.lang.IllegalStateException: incompatible event loop type: io.netty.channel.nio.NioEventLoop
at io.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:411)
at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:72)
at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:60)
at io.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:64)
at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:320)
at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:271)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:235)
at org.apache.rocketmq.remoting.netty.NettyRemotingServer.start(NettyRemotingServer.java:212)
at org.apache.rocketmq.namesrv.NamesrvController.start(NamesrvController.java:156)
at org.apache.rocketmq.namesrv.NamesrvStartup.start(NamesrvStartup.java:154)
at org.apache.rocketmq.namesrv.NamesrvStartup.main0(NamesrvStartup.java:58)
at org.apache.rocketmq.namesrv.NamesrvStartup.main(NamesrvStartup.java:51)

通过抛出的异常追查一下源码

源码位置

发现在执行构造函数的时候初始化的是下面代码 90-143行

public NettyRemotingServer(final NettyServerConfig nettyServerConfig,
final ChannelEventListener channelEventListener) {
super(nettyServerConfig.getServerOnewaySemaphoreValue(), nettyServerConfig.getServerAsyncSemaphoreValue());
this.serverBootstrap = new ServerBootstrap();
this.nettyServerConfig = nettyServerConfig;
this.channelEventListener = channelEventListener; int publicThreadNums = nettyServerConfig.getServerCallbackExecutorThreads();
if (publicThreadNums <= 0) {
publicThreadNums = 4;
} this.publicExecutor = Executors.newFixedThreadPool(publicThreadNums, new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0); @Override
public Thread newThread(Runnable r) {
return new Thread(r, "NettyServerPublicExecutor_" + this.threadIndex.incrementAndGet());
}
}); this.eventLoopGroupBoss = new NioEventLoopGroup(1, new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0); @Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyBoss_%d", this.threadIndex.incrementAndGet()));
}
}); if (useEpoll()) {
this.eventLoopGroupSelector = new EpollEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
private int threadTotal = nettyServerConfig.getServerSelectorThreads(); @Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyServerEPOLLSelector_%d_%d", threadTotal, this.threadIndex.incrementAndGet()));
}
});
} else {
this.eventLoopGroupSelector = new NioEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
private int threadTotal = nettyServerConfig.getServerSelectorThreads(); @Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyServerNIOSelector_%d_%d", threadTotal, this.threadIndex.incrementAndGet()));
}
});
} loadSslContext();
}

也就是说这里接收链接的线程池 eventLoopGroupBoss 永远都是 NioEventLoopGroup  如果设置了useEpollNativeSelector=true就会初始化EpollEventLoopGroup这个类处理请求

这样就会造成两种线程模型的不兼容状态

导致出现异常 java.lang.IllegalStateException: incompatible event loop type: io.netty.channel.nio.NioEventLoop


按常理说阿里的人不会出现这样的低级错误啊

回头又看了看github的bug列表果然有人提这个问题bug还是开启状态

????为什么?

难道是我使用配置有问题吗?还是哪里理解有误那?知道的网友可以告诉我啊!!!!


最新消息我也提交了bug维护人员已经修改bug但是要等到4.4.1版本才可以修正

RocketMQ4.3.X关于设置useEpollNativeSelector = true报错问题的更多相关文章

  1. MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed

    MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed 1.安装完MySQL设置root密码报错如下 [root@vm ...

  2. mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    注:本文来源于<  mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy r ...

  3. Python模块学习之xlrd 读取Excel时传入formatting_info=True报错:NotImplementedError: formatting_info=True not yet implemented

    问题:xlrd读取Excel时传入 formatting_info=True 报错 之前我们使用读取xls文件的时候都是使用的xlrd库,但是这个库只能操作 .xls格式,对于后来的 .xlsx的版本 ...

  4. error_reporting() 设置 PHP 的报错级别并返回当前级别

    error_reporting() 设置 PHP 的报错级别并返回当前级别. 语法 error_reporting(report_level) 如果参数 level 未指定,当前报错级别将被返回.下面 ...

  5. django2.0变动数据库设置外键报错

    1.报错TypeError: __init__() missing 1 required positional argument: 'on_delete' django2.0以后创建数据库外键的时候必 ...

  6. 解决 web.xml is missing and <failOnMissingWebXml> is set to true 报错

    在学习maven模块化构建项目的时候遇到了如下报错信息: web.xml is missing and <failOnMissingWebXml> is set to true. 这时候需 ...

  7. MySQL设置外键报错 #1452 - Cannot add or update a child row: a foreign key constraint fails 解决方法

    MySQL数据库,当我尝试在A表中设置B表的主键为外键时,报出错误:#1452 - Cannot add or update a child row: a foreign key constraint ...

  8. Confluence设置MySQL数据库报错:必须使用'READ-COMMITTED'作为默认隔离级别。

    解决方案: mysql -u root -p123456 SET GLOBAL tx_isolation='READ-COMMITTED'; mysql数据库创建 1.设置mysql隔离级别 SET ...

  9. svn 设置post-commit后 报错svn: Can't convert string from 'UTF-8' to native encoding

    文件语言编码和系统冲突导致的错误,设置svn目录下hooks/post-commit加上: export LANG=zh_CN.GB2312 或者: export LANG=zh_CN.UTF-8

随机推荐

  1. (三)图数据库neo4j的安装配置

    (一)neo4j安装 neo4j有社区版本和企业版,社区版本是免费的,企业版本是收费的.在linux上安装如下步骤: 1.将下载的neo4j-enterprise-3.4.0-unix.tar.gz包 ...

  2. LOJ #6051. 「雅礼集训 2017 Day11」PATH

    完了感觉最近留了好多坑的说,这题也是模模糊糊地会一点 首先我们发现题目要求的是单调不上升的序列个数,那么一个套路就是用值减去下标 然后考虑连续位置的限制,这个我们做一个置换然后尽量向后取 这样拿值和位 ...

  3. 升讯威微信营销系统开发实践:(3)功能介绍与此项目推广过程的一些体会( 完整开源于 Github)

    GitHub:https://github.com/iccb1013/Sheng.WeixinConstruction因为个人精力时间有限,不会再对现有代码进行更新维护,不过微信接口比较稳定,经测试至 ...

  4. Mysql查询的一些操作(查表名,查字段名,查当月,查一周,查当天)

    查询数据库中所有表名 select table_name from information_schema.tables where table_schema='tools' and table_typ ...

  5. Ubuntu16.04 部署安装Docker容器 & 注意事项

    一.部署安装Docker容器 1.1 Ubuntu下安装 crul sudo apt install curl curl是利用URL语法在命令行方式下工作的开源文件传输工具.它被广泛应用在Unix.多 ...

  6. ConfirmCancelBottomSheetDialog【确认取消底部对话框】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 继承BottomSheetDialog,实现简单的确认取消对话框样式. 效果图 代码分析 ConfirmCancelBottomSh ...

  7. Chapter 5 Blood Type——32

    "Where are you all going, exactly?" He was still looking ahead, expressionless. “真的,你要去哪里? ...

  8. [开发技巧]·HTML检测输入已完成自动填写下一个内容

    [开发技巧]·HTML检测输入已完成自动填写下一个内容 个人网站 --> http://www.yansongsong.cn 在上一个博客中简易实现检测输入已完成,我们实现了检测输入已完成,现在 ...

  9. Flink中的Time

    戳更多文章: 1-Flink入门 2-本地环境搭建&构建第一个Flink应用 3-DataSet API 4-DataSteam API 5-集群部署 6-分布式缓存 7-重启策略 8-Fli ...

  10. Linux文本三剑客超详细教程---grep、sed、awk

    awk.grep.sed是linux操作文本的三大利器,合称文本三剑客,也是必须掌握的linux命令之一.三者的功能都是处理文本,但侧重点各不相同,其中属awk功能最强大,但也最复杂.grep更适合单 ...