err_connection_aborted(err_connection_aborted怎么解决)

最近有很多读者朋友和朋友交朋友err_connection_aborted有疑问。有网友整理了相关内容,希望能回答你的疑惑。err_connection_aborted如何解决,本网站也为您找到了问题的答案,希望对您有所帮助。

标签

mysql主从中断, 慢慢查询,慢慢查询太大,my_net_writ()

作者

Matthew

时间

2022-02-09

告警

出现告警!触发报警名称: 192.168.32.79:MySQL IO thread stopped报警开始时间:2022.02.09 09:08:20报警状态: PROBLEM告警级别: 严重监控项值:Slave IO thread running (06_slave_192.168.32.79:mysql.slave.Slave_IO_Running): Connecting原始事件ID: 170558153当前时间:2022.02.09 09:08:23

查看错误的日志

数据库异常时间。022-02-09T08:42:12.598396 08:00 50408604[Note]Aborted connection 50408604 to db: 'finenter' user: 'finenter' host: '192.168.50.56' (Got an error reading communication packets)2022-02-09T01:07:34.069934Z mysqld_safe Number of processes running now: 02022-02-09T01:07:34.073206Z mysqld_safe mysqld restarted2022-02-09T09:07:34.308228 08:00 0[Warning]'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.2022-02-09T09:07:34.308361 08:00 0[Note]--secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled2022-02-09T09:07:34.308395 08:00 0[Note]/usr/local/mysql/bin/mysqld (mysqld 5.7.16-log) starting as process 22048 ..这一段是mysql开始启动的sql2022-02-09T09:07:37.104002 08:00 0[Note]InnoDB: Opened 3 undo tablespaces2022-02-09T09:07:37.104025 08:00 0[Note]InnoDB: 3 undo tablespaces made active2022-02-09T09:07:37.104252 08:00 0[Note]InnoDB: Highest supported file format is Barracuda.2022-02-09T09:07:37.303950 08:00 0[Note]InnoDB: Log scan progressed past the checkpoint lsn 93524331760522022-02-09T09:07:37.304003 08:00 0[Note]InnoDB: Doing recovery: scanned up to log sequence number 93524331811522022-02-09T09:07:37.501117 08:00 0[Note]InnoDB: Doing recovery: scanned up to log sequence number 93524331811522022-02-09T09:07:37.506272 08:00 0[Note]InnoDB: Database was not shutdown normally!2022-02-09T09:07:37.506291 08:00 0[Note]InnoDB: Starting crash recovery.2022-02-09T09:07:37.816635 08:00 0[Note]InnoDB: Transaction 11296772973 was in the XA prepared state.2022-02-09T09:07:37.824610 08:00 0[Note]InnoDB: Transaction 11296772973 was in the XA prepared state.2022-02-09T09:07:37.828609 08:00 0[Note]InnoDB: Transaction 11296772975 was in the XA prepared state.2022-02-09T09:07:37.828632 08:00 0[Note]InnoDB: Transaction 11296772975 was in the XA prepared state.2022-02-09T09:07:37.828647 08:00 0[Note]InnoDB: 2 transaction(s) which must be rolled back or cleaned up in total 0 row operations to undo2022-02-09年数据库启动T09:07:41.579857 08:00 0[Note]/usr/local/mysql/bin/mysqld: ready for connections.Version: '5.7.16-log' socket: '/usr/local/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)2022-02-09T09:07:44.746676 08:00 47[Note]Aborted connection 47 to db: 'unconnected' user: 'app_finenter' host: '192.168.50.116' (Got an error reading communication packets)2022-02-09T09:07:45.907252 08:00 75[Note]Aborted connection 75 to db: 'unconnected' user: 'app_finenter' host: '192.168.50.115' (Got an error reading communication packets)2022-02-09T09:08:34.038236 08:00 259[Note]Start binlog_dump to master_thread_id(259) slave_server(32110), pos(, 4)2022-02-09T09:08:34.039017 08:00 260[Note]Start binlog_dump to master_thread_id(260) slave_server(3280), pos(, 4)2022-02-09T09:08:34.042458 08:00 261[Note]Start binlog_dump to master_thread_id(261) slave_server(3279), pos(, 4)2022-02-09T09:08:34.046842 08:00 262[Note]Start binlog_dump to master_thread_id(262) slave_server(3309), pos(, 4)2022-02-09T09:08:34.077449 08:00 264[Note]Start binlog_dump to master_thread_id(264) slave_server(3217), pos(, 4)2022-02-09T09:08:34.083366 08:00 261[Note]Aborted connection 261 to db: 'unconnected' user: 'repl' host: '192.168.32.79' (Failed on my_net_write())2022-02-09T09:08:34.111652 08:00 263[Note]Start binlog_dump to master_thread_id(263) slave_server(3331), pos(, 4)2022-02-09T09:09:12.242692 08:00 0[Note]InnoDB: Buffer pool(s) load completed at 220209 9:09:12

重启原因

用pt工具分析较大的慢查询文件,由于资源不足mysql异常重启了

从库报错

Last_IO_Error: Fatal error: Failed to run 'after_read_event' hook

分析源码

我们知道,mysqld多线程C/S网络应用的架构,所以通过网络读写数据是必不可少的,所以写数据可能会失败。如果mysql这种错误发生在错误的日志中,说明是mysqld将网络包发送到客户端时失败,当然,引申到复制场景,说明是在复制过程中,master向slave推送binlog写网络数据包失败。

查看master_dump_thread 逻辑

需要确定master在send binlog退出失败dump thread根据错误的日志提示,进入相关代码查看逻辑。错误代码在以下位置inline int Binlog_sender::send_packet(){ DBUG_ENTER("Binlog_sender::send_packet"); DBUG_PRINT("info", ("Sending event of type %s", Log_event::get_type_str( (Log_event_type)m_packet.ptr()[1 EVENT_TYPE_OFFSET]))); // We should always use the same buffer to guarantee that the reallocation // logic is not broken. if (DBUG_EVALUATE_IF("simulate_send_error", true, my_net_write( m_thd->get_protocol_classic()->get_net(), (uchar*) m_packet.ptr(), m_packet.length()))) { set_unknow_error("Failed on my_net_write()"); DBUG_RETURN(1); }

调用关系

(gdb) bt#0 Binlog_sender::send_packet (this=0x7fea741655d0) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:1158#1 0x000000000190f74e in Binlog_sender::send_packet_and_flush (this=0x7fea741655d0) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:1182#2 0x000000000190e181 in Binlog_sender::send_heartbeat_event (this=0x7fea741655d0, log_pos=504) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:1143#3 0x000000000190ee01 in Binlog_sender::wait_with_heartbeat (this=0x7fea741655d0, log_pos=504) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:633#4 0x000000000190ecd7 in Binlog_sender::wait_new_events (this=0x7fea741655d0, log_pos=504) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:599#5 0x000000000190e938 in Binlog_sender::get_binlog_end_pos (this=0x7fea741655d0, log_cache=0x7fea74165020) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:365#6 0x000000000190c5e0 in Binlog_sender::send_binlog (this=0x7fea741655d0, log_cache=0x7fea74165020, start_pos=123) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:313#7 0x000000000190c1b4 in Binlog_sender::run (this=0x7fea741655d0) at /data/mysql-server-explain_ddl/sql/rpl_binlog_sender.cc:225

结果层层返回到Binlog_sender::run

大致看下Binlog_sender::run的逻辑

void Binlog_sender::run(){ while (!has_error() && !m_thd->killed) { if (send_binlog(&log_cache, start_pos)) break; }}

解释到这里,大概就清楚了吧。

主题测试文章,只做测试使用。发布者:艾迪号,转转请注明出处:https://www.cqaedi.cn/baike/39723.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023年 1月 11日 下午3:33
下一篇 2023年 1月 11日 下午4:10

相关推荐

  • 波波丁野菜图片大全(波波丁野菜能治什么病)

    “波波丁”,是胶东人对蒲公英的称呼,这种野菜在当地农村很受欢迎。 它之所以受欢迎,主要有三个原因。首先,波波丁很容易在果园的环境中生长,而胶东半岛有大片的苹果园和樱桃园,对于农民来说,想吃波波丁,到自家的地里挖就行,一点也不费劲。 其次,荠菜、苦菜虽然也是开春之后的应季野菜,但开花之后就容易“变老”,影响口感。而波波丁就要好得多,即便是开了花,挖回家吃也不影…

    2023年 5月 11日
    00
  • 录取通知书寄到哪里录取通知书寄到哪里都可以吗

    1、录取通知书寄到哪里 每年的高考结束后,考生们都期待着收到心仪大学的录取通知书。那么,这封重要的信件会寄到哪里呢? 考生需要明确一点,录取通知书一般是寄送到考生所填报的通讯地址。在填报志愿时,考生需要仔细填写个人信息,包括家庭住址和联系方式。大学招生办公室会根据这些信息来寄送录取通知书。 通常情况下,录取通知书会通过邮寄的方式寄送给考生。邮寄是一种安全可靠…

    百科大全 2023年 9月 30日
    00
  • 国内前100所大学排名(国内前100所大学排名榜)

    最近,许多读者对中国前100所大学的排名有疑问。一些网民整理了相关内容,希望回答您的疑问。关于中国前100所大学的排名,本网站也为您找到了问题的答案,希望能对您有所帮助。 ##2022年就业季#

    百科大全 2023年 3月 5日
    00
  • 川加一横(川加一横念什么)

    最近有很多读者朋友对川加一横有疑问。有网友整理了相关内容,希望能回答你的疑惑。这个网站已经为你找到了关于川加一横念的问题的答案,希望对你有所帮助。 前言 除了南方的广东省,四川省有21个市州,全国再也找不到像四川这样热闹的大家庭了。 众所周知,生活在四川的大家庭里,有兄弟、兄弟、姐妹和姐妹。虽然每个成员的名字都很容易记住,但我不知道当网民们在路上看到兄弟姐妹…

    百科大全 2023年 3月 26日
    00
  • ipad pencil怎么充电(ipad pencil怎么充电多久)

    IT之家 10 月 19 日消息,昨日晚间,苹果正式发布了第十代 iPad。iPad 10 采用直角边框设计,搭载 A14 处理器,配备 USB-C 接口。 苹果表示,Apple Pencil(第一代)支持新款 iPad,但需使用新的 USB-C 转 Apple Pencil 转换器进行配对和充电,该转换器随附于最新版本的 Apple Pencil(第一代)…

    2022年 11月 17日
    00

站长QQ

7401002

在线咨询: QQ交谈

邮件:7401002@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信