前一阵子刚整理完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. Android之greenDao使用

    文章大纲 一.greenDao简介二.greenDao实战三.项目源码下载四.参考文章   一.greenDao简介 1. 什么是greenDao   GreenDAO是一个开源的Android OR ...

  2. windows之如何把iso文件转换为VHD文件

    (1)Convert-WindowsImage.ps1的下载路径: 链接:https://pan.baidu.com/s/18duFQFW8T_yI2JeQ1lhJgQ 提取码:b5ps autoun ...

  3. [ gczdac ] 20190213 开博客啦!

    测试一下! 今天开了新博客! 还自己改了下首页! 开心!!!!! 访者必阅 https://www.cnblogs.com/gczdac/ https://blog.csdn.net/qq_43540 ...

  4. 深度优先搜索(DFS)与广度优先搜索(BFS)的Java实现

    1.基础部分 在图中实现最基本的操作之一就是搜索从一个指定顶点可以到达哪些顶点,比如从武汉出发的高铁可以到达哪些城市,一些城市可以直达,一些城市不能直达.现在有一份全国高铁模拟图,要从某个城市(顶点) ...

  5. Android开发:Android Studio开发环境配置

    一.android studio下载: 1.Windows版: 下载地址:https://pan.baidu.com/s/1-sg4dN_2B5nn2YJf-C7XLQ 提取码:yedc 2.Mac版 ...

  6. Docker 删除&清理镜像

    文章首发自个人网站:https://www.exception.site/docker/docker-delete-image 本文中,您将学习 Docker 如何删除及清理镜像? 一.通过标签删除镜 ...

  7. 分布式事务解决方案FESCAR

    项目地址:FESCAR 以下是官网的文档.简介2019年,Fescar 是 阿里巴巴 开源的 分布式事务中间件,以 高效 并且对业务 0 侵入 的方式,解决 微服务 场景下面临的分布式事务问题. 1. ...

  8. 【ASP.NET Core快速入门】(三)准备CentOS和Nginx环境

    基本软件 VMware虚拟机 centos:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-170 ...

  9. [SpringBoot guides系列翻译]调用RESTfulWebService

    原文 参考链接 CommandLineRunner Bean 翻译如何调用RESTful WebService 这节将演示如何在SpringBoot里面调用RESTful的WebService. 构建 ...

  10. keil进阶教程

    前言 keil只懂得创建软件工程是远远不够的,如果要想顺心使用,应该要懂得部分配置,这样使用心情顺畅,码代码也会越发高效. 设置字号字体 编辑点击编辑菜单,会出现很多子目录,找到配置,点击进入设置页面 ...