RocketMQ4.3.X关于设置useEpollNativeSelector = true报错问题
前一阵子刚整理完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报错问题的更多相关文章
- MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed
MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed 1.安装完MySQL设置root密码报错如下 [root@vm ...
- 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 ...
- Python模块学习之xlrd 读取Excel时传入formatting_info=True报错:NotImplementedError: formatting_info=True not yet implemented
问题:xlrd读取Excel时传入 formatting_info=True 报错 之前我们使用读取xls文件的时候都是使用的xlrd库,但是这个库只能操作 .xls格式,对于后来的 .xlsx的版本 ...
- error_reporting() 设置 PHP 的报错级别并返回当前级别
error_reporting() 设置 PHP 的报错级别并返回当前级别. 语法 error_reporting(report_level) 如果参数 level 未指定,当前报错级别将被返回.下面 ...
- django2.0变动数据库设置外键报错
1.报错TypeError: __init__() missing 1 required positional argument: 'on_delete' django2.0以后创建数据库外键的时候必 ...
- 解决 web.xml is missing and <failOnMissingWebXml> is set to true 报错
在学习maven模块化构建项目的时候遇到了如下报错信息: web.xml is missing and <failOnMissingWebXml> is set to true. 这时候需 ...
- 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 ...
- Confluence设置MySQL数据库报错:必须使用'READ-COMMITTED'作为默认隔离级别。
解决方案: mysql -u root -p123456 SET GLOBAL tx_isolation='READ-COMMITTED'; mysql数据库创建 1.设置mysql隔离级别 SET ...
- 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
随机推荐
- 300+ Manual Testing and Selenium Interview Questions and Answers
Manual testing is a logical approach and automation testing complements it. So both are mandatory an ...
- redis 安装-配置
下载链接: wget http://download.redis.io/releases/redis-4.0.9.tar.gz ※ 如果没有 直接复制url 到浏览器下载 1:下载完成 2:解压 t ...
- Visual Studio Code-批量在文末添加文本字段
小技巧一例,在vs code或notepad++文末批量添加文本字段信息,便于数据信息的完整,具体操作如下: Visual Studio Code批量添加"@azureyun.com&quo ...
- python3 文件操作练习 r+ w+ a+ 的理解
突然来一句:“慨然有经略四方之志” 文件操作三部曲:1.先用open打开 2.再写关闭 3.再回到中间写操作 为啥要刚打开就关闭 那是很容易望,所以先写上... 基本格式 f = open( ...
- 特征提取方法: one-hot 和 TF-IDF
one-hot 和 TF-IDF是目前最为常见的用于提取文本特征的方法,本文主要介绍两种方法的思想以及优缺点. 1. one-hot 1.1 one-hot编码 什么是one-hot编码?one-ho ...
- 为什么要重写hashcode和equals方法?初级程序员在面试中很少能说清楚。
我在面试 Java初级开发的时候,经常会问:你有没有重写过hashcode方法?不少候选人直接说没写过.我就想,或许真的没写过,于是就再通过一个问题确认:你在用HashMap的时候,键(Key)部分, ...
- 『练手』004 Laura.SqlForever如何扩展 导航栏 工具栏 右键菜单 插件
004 Laura.SqlForever如何扩展 导航栏 工具栏 右键菜单 插件 导航栏 插件扩展 比如下图的 窗口 > 关闭所有文档 这个导航栏: 在 任何程序集,任何命名空间,任 ...
- 前端笔记之JavaScript面向对象(三)初识ES6&underscore.js&EChart.js&设计模式&贪吃蛇开发
一.ES6语法 ES6中对数组新增了几个函数:map().filter().reduce() ES5新增的forEach(). 都是一些语法糖. 1.1 forEach()遍历数组 forEach() ...
- 几个常用的vscode插件
1.Vetur 可以对.vue文件格式做语法高亮,开发基于Vue项目的标配插件 2.Power Mode 在写代码时出现如烟花.粒子.火焰之类的效果,增加写代码的乐趣 3.Chinese (simpl ...
- 第三节:dingo/API 最新版 V2.0 之 Creating API Endpoints (连载)
对于这篇文章的标题,其实,直译就是创建api端点.但是,真的很难懂,我还是写为API路由吧.每篇,文章,我都会全部去进行实践操作,力求写一个好点的教程. 本文英文地址——>https://git ...