突然收到告警短信,提示有一组服务器MHA已经切换,登录服务器后查看错误日志如下(其中相关insert语句已经处理):

mysql版本:5.5.24

 ::  InnoDB: Assertion failure in thread  in file ha_innodb.cc line
InnoDB: Failing assertion: current <= max_value
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
:: UTC - mysqld got signal ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail. key_buffer_size=
read_buffer_size=
max_used_connections=
max_threads=
thread_count=
connection_count=
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = K bytes of memory
Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x6ba32000
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f356dcade20 thread_stack 0x40000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x2e)[0x76cf7e]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x386)[0x6566d6]
/lib64/libpthread.so.[0x305b20f790]
/lib64/libc.so.(gsignal+0x35)[0x305ae32625]
/lib64/libc.so.(abort+0x175)[0x305ae33e05]
/usr/local/mysql/bin/mysqld[0x7ceb5a]
/usr/local/mysql/bin/mysqld[0x7da5e0]
/usr/local/mysql/bin/mysqld(_ZN7handler21update_auto_incrementEv+0x209)[0x659909]
/usr/local/mysql/bin/mysqld[0x7d818f]
/usr/local/mysql/bin/mysqld(_ZN7handler12ha_write_rowEPh+0x51)[0x65b961]
/usr/local/mysql/bin/mysqld(_Z12write_recordP3THDP5TABLEP12st_copy_info+0x5d)[0x54a88d]
/usr/local/mysql/bin/mysqld(_Z12mysql_insertP3THDP10TABLE_LISTR4ListI4ItemERS3_IS5_ES6_S6_15enum_duplicatesb+0xa4a)[0x5508ba]
/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THD+0x24d6)[0x5601f6]
/usr/local/mysql/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0xfe)[0x563bee]
/usr/local/mysql/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1356)[0x564fc6]
/usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0xc2)[0x5652f2]
/usr/local/mysql/bin/mysqld(_Z24do_handle_one_connectionP3THD+0xf2)[0x5f0b02]
/usr/local/mysql/bin/mysqld(handle_one_connection+0x4a)[0x5f0bda]
/lib64/libpthread.so.[0x305b207a51]
/lib64/libc.so.(clone+0x6d)[0x305aee89ad] Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (8e8bcc10): INSERT INTO t1 (name) VALUES ('yayun')
Connection ID (thread ID):
Status: NOT_KILLED

提示INSERT INTO t1 (name) VALUES ('yayun');导致mysqld crash
这么简单的语句也会导致mysqld crash?

我们看看表结构:

mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

如果不仔细看还发现不出猫腻,那么仔细看看呢?没错,就是id字段,是tinyint类型,tinyint的取值范围是:带符号的范围是-128到127。无符号的范围是0到255
在建表的时候就指定了AUTO_INCREMENT=128,已经到临界点了。当再次插入就会导致mysqld进程重启。再次插入则改值就被重新设置了。我们来看看。

mysql> CREATE TABLE t1 (id  TINYINT not null AUTO_INCREMENT PRIMARY KEY,name char(20)) ENGINE=InnoDB AUTO_INCREMENT=128;
Query OK, 0 rows affected (0.00 sec) mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

插入一条记录,马上导致mysqld进程crash。

mysql>  INSERT INTO t1 (name) VALUES ('yayun');
ERROR 2013 (HY000): Lost connection to MySQL server during query

再次插入就ok了。

mysql> select * from t1;
+----+-------+
| id | name |
+----+-------+
| 1 | yayun |
| 2 | yayun |
+----+-------+
2 rows in set (0.00 sec) mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

总结:

总之出现上面的情况也是历史业务留下来的坑,已经督促开发进行更改。上面这个属于一个bug,该bug早有人反馈,我又踩一次坑。

参考资料:

http://bugs.mysql.com/bug.php?id=66836

mysqld诡异crash的更多相关文章

  1. MySQL 服务(mysqld)crash

    场景:     数据从 10.165.98.190 自建MySQL同步至 阿里云 MongoDB过程中,mysql服务会崩溃,同步数据失败. 原因分析:     经DBA 分析,10.165.98.1 ...

  2. GDB调试命令小结

    1.启动调试 前置条件:编译生成执行码时带上 -g,如果使用Makefile,通过给CFLAGS指定-g选项,否则调试时没有符号信息.gdb program //最常用的用gdb启动程序,开始调试的方 ...

  3. MYSQL MHA

    MYSQL MHA 简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于 Face ...

  4. MySQL高可用架构之MHA

    简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是 ...

  5. MySQL数据丢失讨论

    原文地址:http://hatemysql.com/tag/sync_binlog/ 1.  概述 很多企业选择MySQL都会担心它的数据丢失问题,从而选择Oracle,但是其实并不十分清楚什么情况下 ...

  6. linux 下mysql的启动 、调试、排错

    Linux 下 MySQL 启动与关闭 说明 一.启动 1.1  MySQL 进程 可以用ps 命令查看进程: [root@rac2 ~]# ps -ef|grep mysql root     21 ...

  7. MySQL HA方案之MySQL半复制+MHA+Keepalived+Atlas+LVS[转]

    MySQL HA方案之MySQL半复制+MHA+Keepalived+Atlas+LVS 简介 目前Mysql高可用的方案有好多,比如MMM,heartbeat+drbd,Cluster等,还有per ...

  8. 浅谈mysql的两阶段提交协议

    前两天和百度的一个同学聊MySQL两阶段提交,当时自信满满的说了一堆,后来发现还是有些问题的理解还是比较模糊,可能是因为时间太久了,忘记了吧.这里再补一下:) 5.3.1事务提交流程 MySQL的事务 ...

  9. 【MySQL】mysql buffer pool结构分析

    转自:http://blog.csdn.net/wyzxg/article/details/7700394 MySQL官网配置说明地址:http://dev.mysql.com/doc/refman/ ...

随机推荐

  1. TOMCAT配置外部应用

    原来我们都是把项目放到webapps目录下,但其实是可以把项目放到其他文件夹下的,如果把项目放到其他目录下同时也希望tomcat可以运行它,有两种方法: 第一种方法:   conf/server.xm ...

  2. getTickCount()函数 VS GetTickCount()函数

    这俩函数看上去长得太像了,笔者曾经马大哈地把两者当成一个函数了(确实长得很像),知道有一天发现返回的值离预期值差很远差仔细查了下. 1. getTickCount() 实际上,该函数为opencv中的 ...

  3. 新的开始—js客户端onlick无法响应

    第一次写博客,也是为了以后遇到同样的问题时可以找到,onlick无法响应在百度一些都有解释,这只是一个个人记录而已 问题: function change_tp(ProInfo_id, color_i ...

  4. git学习 分支特殊处理和配置03

    Bug分支: 当在一个分支上工作的时候:突然到其它分支修复bug,当前分支工作还没到要提交的程度:这时候可以使用git stash来将工作分支暂时存储起来: 用git stash list查看stas ...

  5. 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels

    题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...

  6. webservice 学习笔记

    1.webservice的概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的 ...

  7. SQL: See the TSQL underneath the sp_execute calls

    When use SQL Server Profiler, on the Events Selection tab, check Show all events; Find the Store Pro ...

  8. [转]七天学会NodeJS

    转:http://nqdeng.github.io/7-days-nodejs/ NodeJS基础 什么是NodeJS JS是脚本语言,脚本语言都需要一个解析器才能运行.对于写在HTML页面里的JS, ...

  9. 一个动画 Label (走马观花)

    UILabel中一个水平移动的Label UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 300, 300)]; U ...

  10. BZOJ4503: 两个串

    Description 兔子们在玩两个串的游戏.给定两个字符串S和T,兔子们想知道T在S中出现了几次, 分别在哪些位置出现.注意T中可能有“?”字符,这个字符可以匹配任何字符. Input 两行两个字 ...