首页 文章 精选 留言 我的

精选列表

搜索[Bug修复],共10000篇文章
优秀的个人博客,低调大师

修复centos7 网卡启动不了方法

刚刚装好的虚拟机突然不能上网了,报错很诡异,具体报错如下: /etc/init.d/network restart Restarting network (via systemctl): Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details. [失败] 使用systemctl status network.service命令查看结果如下: network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network) Active:failed(Result: exit-code) since 三 2016-08-17 11:34:36 CST; 54s ago Docs: man:systemd-sysv-generator(8) Process: 3847 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE) 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn network[3847]: RTNETLINK answers: File exists 8月 17 11:34:36 python.cn systemd[1]: network.service: control process exited, code=exited status=1 8月 17 11:34:36 python.cn systemd[1]:Failed to start LSB: Bring up/down networking. 8月 17 11:34:36 python.cn systemd[1]: Unit network.service entered failed state. 8月 17 11:34:36 python.cn systemd[1]: network.service failed. 查看系统日志,报错如下: Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python network: RTNETLINK answers: File exists Aug 17 11:34:36 python systemd: network.service: control process exited, code=exited status=1 Aug 17 11:34:36 python systemd:Failed to start LSB: Bring up/down networking. Aug 17 11:34:36 python systemd: Unit network.service entered failed state. Aug 17 11:34:36 python systemd: network.service failed. Aug 17 11:36:28 python systemd: Starting LSB: Bring up/down networking... Aug 17 11:36:29 python network: 正在打开环回接口: 无法载入文件 '/etc/sysconfig/network-scripts/ifcfg-lo' Aug 17 11:36:29 python network: 无法载入文件 '/etc/sysconfig/network-scripts/ifcfg-lo' Aug 17 11:36:29 python network: 无法载入文件 '/etc/sysconfig/network-scripts/ifcfg-lo' Aug 17 11:36:29 python network: 无法载入文件 '/etc/sysconfig/network-scripts/ifcfg-lo' Aug 17 11:36:29 python network: [ 确定 ] Aug 17 11:36:29 python network: 正在打开接口 eno16777736: 错误:激活连接失败:No suitable device found for this connection. 经查,确认/etc/sysconfig/network-scripts/ifcfg-lo文件是存在的。问题出现在哪里呢?无法,只好百度一下吧,百度出来的结果竟然基本一样。 百度答案: mac地址不对,修改mac地址。 也许有人确实是mac问题,但是莫名其妙怎么可能mac地址更改了,除非你添加新网卡或者克隆的虚拟机。 我特么真笑了,天下百度文章一大抄啊。。。。。。。。 没办法了,Google一下吧,偶然看到一个文章,大意是跟系统自带的NetworkManager这个管理套件有关系,关掉就可以解决。 试一下: systemctl stop NetworkManager systemctl disable NetworkManager Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service. Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service. Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service. 重新启动网络: systemctl start network.service ifconfig |grep eno eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.192 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:fe3d:b305 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:3d:b3:05 txqueuelen 1000 (Ethernet) RX packets 2 bytes 120 (120.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 22 bytes 3551 (3.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 网络正常启动,访问正常。

优秀的个人博客,低调大师

MySQL的match函数在sp中使用的BUG解析

一、问题发现 在一次开发中在sp中使用MySQL PREPARE以后,使用match AGAINST语句作为prepare stmt的参数后,发现执行第二遍call会导致数据库crash,于是开始动手调查问题发生的原因。 注:本次使用的 MySQL 数据库版本为最新的debug版本。 SQL语句示例: CREATE TABLE t1 (a INT, b VARCHAR(10)); DELIMITER $$ CREATE PROCEDURE p1() begin declare a VARCHAR(200); declare b TEXT; set a = 'Only MyISAM tables'; set b ='support collections'; set @bb := match(a,b) AGAINST ('collections'); prepare stmt1 from 'select * from t1 where ?'; execute stmt1 using @bb; end$$ DELIMITER ; 执行结果: mysql> call p1; ERROR 1210 (HY000): Incorrect arguments to MATCH mysql> call p1; 这里发现代码crash了 ERROR 2013 (HY000): Lost connection to MySQL server during query 二、问题调查过程 1、首先查看错误堆栈信息,可以看到Item_func_match::val_real函数的item->real_item()->type()不等于FIELD_ITEM引起的,打印堆栈看了一下,此时的item->real_item()为Item_splocal,明显不是FIELD_ITEM。 #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff7568859 in __GI_abort () at abort.c:79 #2 0x00007ffff7568729 in __assert_fail_base (fmt=0x7ffff76fe588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55555bd2e340 "std::all_of(args, args + arg_count, [](const Item *item) { return item->real_item()->type() == FIELD_ITEM; })", file=0x55555bd2a9e0 "/mysql/sql/item_func.cc", line=9769, function=<optimized out>) at assert.c:92 #3 0x00007ffff7579fd6 in __GI___assert_fail ( assertion=0x55555bd2e340 "std::all_of(args, args + arg_count, [](const Item *item) { return item->real_item()->type() == FIELD_ITEM; })", file=0x55555bd2a9e0 "/mysql/sql/item_func.cc", line=9769, function=0x55555bd2e300 "virtual double Item_func_match::val_real()") at assert.c:101 #4 0x0000555558f9e17e in Item_func_match::val_real (this=0x7fff2cc86928) 这里导致的crash at /mysql/sql/item_func.cc:9769 #5 0x0000555558f97f7e in Item_func_set_user_var::check (this=0x7fff2cc88200, use_result_field=false) at /mysql/sql/item_func.cc:8238 #6 0x00005555592d74d3 in set_var_user::check (this=0x7fff2cc88388) at /mysql/sql/set_var.cc:1874 #7 0x00005555592d5cd6 in sql_set_variables (thd=0x7fff2c001050, var_list=0x7fff2cc87210, opened=true) at /mysql/sql/set_var.cc:1442 #8 0x00005555594d89ed in mysql_execute_command (thd=0x7fff2c001050, first_level=false) at /mysql/sql/sql_parse.cc:4051 #9 0x000055555930c7a8 in sp_instr_stmt::exec_core (this=0x7fff2cc883d8, thd=0x7fff2c001050, nextp=0x7fffe02ed8b4) at /mysql/sql/sp_instr.cc:1039 #10 0x000055555930ae0b in sp_lex_instr::reset_lex_and_exec_core (this=0x7fff2cc883d8, thd=0x7fff2c001050, nextp=0x7fffe02ed8b4, open_tables=false) at /mysql/sql/sp_instr.cc:457 #11 0x000055555930bc74 in sp_lex_instr::validate_lex_and_execute_core (this=0x7fff2cc883d8, thd=0x7fff2c001050, nextp=0x7fffe02ed8b4, open_tables=false) at /mysql/sql/sp_instr.cc:771 #12 0x000055555930c3ad in sp_instr_stmt::execute (this=0x7fff2cc883d8, thd=0x7fff2c001050, nextp=0x7fffe02ed8b4) at /mysql/sql/sp_instr.cc:956 #13 0x00005555592fa772 in sp_head::execute (this=0x7fff2cc76da0, thd=0x7fff2c001050, merge_da_on_success=true) at /mysql/sql/sp_head.cc:2279 #14 0x00005555592fcec2 in sp_head::execute_procedure (this=0x7fff2cc76da0, thd=0x7fff2c001050, args=0x0) at /mysql/sql/sp_head.cc:2995 #15 0x00005555593661c9 in do_execute_sp (thd=0x7fff2c001050, sp=0x7fff2cc76da0, args=0x0) at /mysql/sql/sql_call.cc:86 2、要想获取sp参数的实际item,应该调用this_item()方法,但是也许作者本来就不想让match支持sp参数,因此这里的写法是对的。但是本来代码不应该运行到这里,因为本来应该直接报错。 double Item_func_match::val_real() { assert(fixed); assert(!has_rollup_expr()); assert(std::all_of(args, args + arg_count, [](const Item *item) { return item->real_item()->type() == FIELD_ITEM; ==>这里的item->real_item()->type()说明不支持Item_splocal })); 3、接着继续调查,查看第一次报错的地方的代码,找到Item_func_match::fix_fields,看到了第一次报错的地方的代码item->type() != Item::FIELD_ITEM,因此代码运行应该在这里报错。但是为何第二次执行会运行到Item_func_match::val_real而不是在Item_func_match::fix_fields就直接报错返回呢?仔细查看下面的代码,发现下面的代码有1个地方有错误。 bool Item_func_match::fix_fields(THD *thd, Item **ref) { if (Item_func::fix_fields(thd, ref) || fix_func_arg(thd, &against) || 上面这里Item_func::fix_fields执行完后使fixed=true 但是如果后面有任何报错的地方导致返回的话,这个值没有修改回false 会导致第二次call sp不会再次执行Item_func_match::fix_fields。 !against->const_for_execution()) { thd->mark_used_columns = save_mark_used_columns; my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST"); return true; } for (uint i = 0; i < arg_count; i++) { item = args[i] = args[i]->real_item(); if (item->type() != Item::FIELD_ITEM || /* Cannot use FTS index with outer table field */ item->is_outer_reference()) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH"); return true; } 三、问题解决方案 通过以上代码解析后作如下修改,正确给fixed赋值,这样就可以保证每次call sp的时候如果遇到报错再次运行还会重新执行fix_fields。 bool Item_func_match::fix_fields(THD *thd, Item **ref) { if (Item_func::fix_fields(thd, ref) || fix_func_arg(thd, &against) || !against->const_for_execution()) { fixed = false; ==>这里需要重新把fixed赋值为false thd->mark_used_columns = save_mark_used_columns; my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST"); return true; } thd->mark_used_columns = save_mark_used_columns; fixed = false; ==>这里需要重新把fixed赋值为false for (uint i = 0; i < arg_count; i++) { item = args[i] = args[i]->real_item()->this_item(); if (item->type() != Item::FIELD_ITEM || /* Cannot use FTS index with outer table field */ item->is_outer_reference()) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH"); return true; } 中间省略 fixed = true; ==>最后没有问题了再赋值为true return false; 现在重新执行call sp,没有问题了。 mysql> call p1; ERROR 1210 (HY000): Incorrect arguments to MATCH mysql> call p1; ERROR 1210 (HY000): Incorrect arguments to MATCH 四、问题总结 本次只是解决了 match 的fix_fields问题,但是如果想让 match 支持 sp 的参数,即Item_splocal的参数的话,代码里面还要做相应修改,包括set @bb := match(a,b) AGAINST ('collections'); 这里面生成的Item_func_match会在这句执行完以后被 cleanup 掉,等到下一句 prepare 想再次使用它的时候会因为找不到该item发生问题,这个是重构 match函数支持 sp 参数需要注意的点。 Enjoy GreatSQL :) 关于 GreatSQL GreatSQL是由万里数据库维护的MySQL分支,专注于提升MGR可靠性及性能,支持InnoDB并行查询特性,是适用于金融级应用的MySQL分支版本。 相关链接: GreatSQL社区 Gitee GitHub Bilibili GreatSQL社区: 社区有奖建议反馈: https://greatsql.cn/thread-54-1-1.html 社区博客有奖征稿详情: https://greatsql.cn/thread-100-1-1.html 社区2022年度勋章获奖名单: https://greatsql.cn/thread-184-1-1.html (对文章有疑问或者有独到见解都可以去社区官网提出或分享哦~) 技术交流群: 微信&QQ群: QQ群:533341697 微信群:添加GreatSQL社区助手(微信号:wanlidbc )好友,待社区助手拉您进群。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册