【原创】MySQL Can't create a new thread报错分析
今天有两台服务器都出现了Can't create a new thread报错。
【故障处理过程】
故障发生后登录服务器,检查mysql进程正常,但登录mysql报下面错误
ERROR 1135 (HY000): Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug。
重启mysql服务,执行没响应,kill -9 mysql进程,从errorlog中看到,停服务的命令由于无法创建新的thread导致执行失败

【问题分析】
这个报错不是mysql本身的问题,根本原因是由于操作系统CentOS 6.4 Linux 2.6.32 的max user processe的默认设置1024太小造成,当mysql线程数大于配置值时,就会出现Can't create a new thread报错。
以其中一台服务器为例,操作系统版本是CentOS release 6.4(Linux version 2.6.32)
配置文件/etc/security/limits.d/90-nproc.conf的默认设置soft limit 是1024

这时mysql进程的Soft Limit也是1024

【问题重现】
在测试机器上将Max processes调整为1024,模拟并发1024以上个线程请求,会出现同样的报错

动态修改mysql进程的系统资源限制后,报错消失
echo -n "Max processes=2048:2048" > /proc/`pidof mysqld`/limits
【解决办法】(针对CentOS 6.4 Linux version 2.6.32以上版本)
1、动态修改mysql进程的系统资源限制(不需重启mysql服务即可生效)
echo -n "Max processes=65535:65535" > /proc/`pidof mysqld`/limits
2、修改/etc/security/limits.d/90-nproc.conf配置文件的配置(下次重启mysql服务生效)

3、建议同时修改上面配置中用户打开最大文件数的限制nofile

【原创】MySQL Can't create a new thread报错分析的更多相关文章
- mysql中大数据表alter增加字段报错:"1034 Incorrect key file for table 'table_name'; try to repair it"
mysql中大数据表alter增加字段报错:"1034 Incorrect key file for table 'table_name'; try to repair it" 现 ...
- 连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的,
连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的, 2018-03-12 17:08:52.532DEBUG[localhost-startStop-1]o.s.beans.factor ...
- mysql 5.7.28 中GROUP BY报错问题 SELECT list is not in GROUP BY clause and contains no
----mysql 5.7.28 中GROUP BY报错问题 SELECT list is not in GROUP BY clause and contains no------ 解决方案: sel ...
- Mysql in子查询中加limit报错
Mysql in子查询中加limit报错 select id from aa where id in ( select id from bb limit 10 ); 改写成 SELECT id FRO ...
- 使用sqoop从Oracle或mysql抽取数据到HDFS遇到的报错及解决
一.参考文档: 1.https://www.rittmanmead.com/blog/2014/03/using-sqoop-for-loading-oracle-data-into-hadoop-o ...
- mysql小知识点汇总---(时间与时间戳的转换, 修改mysql用户名密码, navicate 导入sql文件报错 1153)
1. 时间与时间戳的转换 1.1 时间戳转时间 FROM_UNIXTIME(add_time, '%Y-%m-%d') 1.2 时间转时间戳 UNIX_TIMESTAMP('2015-04-29') ...
- 解决Mysql搭建成功后执行sql语句报错以及区分大小写问题
刚搭建完mysql 8.0以后会: 一.表区分大小写, 二.执行正确的sql语句成功且会报:[Err] 1055 - Expression #1 of ORDER BY clause is not i ...
- Mysql修改root用户密码 For Mac 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
环境 Mysql版本:5.7.12 操作系统:OSX 10.11 安装文件:.dmg文件 MySQL:mysql-5.7.12-osx10.11-x86_64.dmg(注意5.7跟之前的字段有些不同, ...
- MySQL or MariaDB 错误解决方法之报错代码1045
phpMyAdmin登录报错:mysqli_real_connect(): (28000/1045): Access denied for user 'root'@'localhost' (using ...
随机推荐
- ASP.Net执行cmd命令的实现代码
using System; using System.Collections; using System.Configuration; using System.Data; using System. ...
- adb相关基础知识集锦
Android单元测试adb shell am instrument -w adb shell dumpsys adb logcat介绍
- ngx_lua_API 指令详解(六)ngx.thread.spawn、ngx.thread.wait、ngx.thread.kill介绍
摘要:通过lua-nginx-module中的ngx.thread同时执行多个任务. ngx_lua中访问多个第三方服务 ngx_lua中提供了ngx.socket API,可以方便的访问第三方网络服 ...
- PHP 文件加密Zend Guard Loader 学习和使用(如何安装ioncube扩展对PHP代码加密)
一.大体流程图 二.PHP 项目文件加密 下表列出了Zend产品中的PHP版本及其内部API版本和Zend产品版本. 如何加密请往后看 三.如何使用 第一步:确认当前环境 Amai Phalcon 前 ...
- Internet Explorer 6 的15个讨厌的bug和简单的解决方法
关于bug更全的,我推荐去这个网站hasLayout,整理的非常全!三年前就看了,最近手生,又翻出来看看~~虽然上面有很多bug讲解,但是我觉得目前用的比较多或者说是常见的应该属下面这篇文章,15 a ...
- CSS-3 RGBA的使用
由于IE-8及以下都不支持 RGBA(),所以往往大家都不用这个属性,而是用图层叠加的方式去实现我们想要的效果.因为 opacity 这个属性是会影响到子孙元素的. 例如: <div class ...
- 使用storyboard显示UITableView时,如果不修改系统默认生成的tableView:cellForRowAtIndexPath:方法中的代码,则必须为UITableViewCell注册(填写)重用标识符:identifier.必须要代码方法中的标识符一致.
CHENYILONG Blog 使用storyboard显示UITableView时,如果不修改系统默认生成的tableView:cellForRowAtIndexPath:方法中的代码,则必须为UI ...
- Codeforces 237 div2 B. Marathon(关于精度损失的教训)
题目链接:http://codeforces.com/contest/404/problem/B?csrf_token=6292hf3e1h4g5e0d16a996ge6bgcg7g2 解题报告:一个 ...
- Java笔记之java.lang.String#trim
String的trim()方法是使用频率频率很高的一个方法,直到不久前我不确定trim去除两端的空白符时对换行符是怎么处理的点进去看了下源码的实现,才发现String#trim的实现跟我想像的完全不一 ...
- find查找时排除目录及文件
查找根目录下大于500M的文件,排除/proc目录 find / ! -path "/proc/*" -type f -size +500M | sort -rh|xargs ls ...