Linux系统出现hung_task_timeout_secs和blocked for more than 120 seconds的解决方法
Linux系统出现系统没有响应。 在/var/log/message日志中出现大量的 “echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.” 和“blocked for more than 120 seconds”错误。
问题原因:
默认情况下, Linux会最多使用40%的可用内存作为文件系统缓存。当超过这个阈值后,文件系统会把将缓存中的内存全部写入磁盘, 导致后续的IO请求都是同步的。将缓存写入磁盘时,有一个默认120秒的超时时间。 出现上面的问题的原因是IO子系统的处理速度不够快,不能在120秒将缓存中的数据全部写入磁盘。IO系统响应缓慢,导致越来越多的请求堆积,最终系统内存全部被占用,导致系统失去响应。
解决方法:
根据应用程序情况,对vm.dirty_ratio,vm.dirty_background_ratio两个参数进行调优设置。 例如,推荐如下设置:
# sysctl -w vm.dirty_ratio=10
# sysctl -w vm.dirty_background_ratio=5
# sysctl -p
如果系统永久生效,修改/etc/sysctl.conf文件。加入如下两行:
#vi /etc/sysctl.conf
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
sysctl -p
最近遇到过一个问题:
apache服务器的负载飙升到700多,导致无法提供正常的http服务,此时查看系统日志时,发现:
Jan 4 09:57:03 locasv107 kernel: INFO: task httpd:18463 blocked for more than 120 seconds.
Jan 4 09:57:03 locasv107 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
诸如此类的报警日志。
查询了资料后对于该参数的了解为后台对进行的任务由于超时而挂起
从以上的报错信息也给出了简单的解决方案,就是禁止该120秒的超时:echo 0 > /proc/sys/kernel/hung_task_timeout_secs
随后询问了主机工程师:给出方案是按照告警里的提示将该提醒disable
后续询问后给出如下解释:
This is a know bug. By default Linux uses up to 40% of the available memory for file system caching.
After this mark has been reached the file system flushes all outstanding data to disk causing all following IOs going synchronous.
For flushing out this data to disk this there is a time limit of 120 seconds by default.
In the case here the IO subsystem is not fast enough to flush the data withing 120 seconds.
This especially happens on systems with a lof of memory.
The problem is solved in later kernels and there is not “fix” from Oracle.
I fixed this by lowering the mark for flushing the cache from 40% to 10% by setting “vm.dirty_ratio=10″ in /etc/sysctl.conf.
This setting does not influence overall database performance since you hopefully use Direct IO and bypass the file system cache completely.
告知是linux会设置40%的可用内存用来做系统cache,当flush数据时这40%内存中的数据由于和IO同步问题导致超时(120s),所将40%减小到10%,避免超时。
转载:https://www.cnblogs.com/wshenjin/p/7093505.html
https://blog.csdn.net/yanggd1987/article/details/42388421
Linux系统出现hung_task_timeout_secs和blocked for more than 120 seconds的解决方法的更多相关文章
- hung_task_timeout_secs和blocked for more than 120 seconds的解决方法
Linux系统出现hung_task_timeout_secs和blocked for more than 120 seconds的解决方法 Linux系统出现系统没有响应. 在/var/log/me ...
- Linux 日志报错 xxx blocked for more than 120 seconds
监控作业发现一台服务器(Red Hat Enterprise Linux Server release 5.7)从凌晨1:32开始,有一小段时间无法响应,数据库也连接不上,后面又正常了.早上检查了监听 ...
- hung_task_timeout_secs 和 blocked for more than 120 seconds
https://help.aliyun.com/knowledge_detail/41544.html 问题现象 云服务器 ECS Linux 系统出现系统没有响应. 在/var/log/messag ...
- linux 系统中将数据写入文档不能立即保存问题的解决方法
应用场景: 设备跑的是Linux系统,与PC上位机进行通信,上位机可以给Linux发送设备配置信息,Linux将配置信息写入文件中以备设备断电重启时使用. bug现象: 设备正常运行,设备配置信息为A ...
- linux 出错 “INFO: task xxxxxx: 634 blocked for more than 120 seconds.”的3种解决方案(转)
linux 出错 “INFO: task xxxxxx: 634 blocked for more than 120 seconds.”的3种解决方案 1 问题描述 服务器内存满了,ssh登录失败 , ...
- linux 出错 “INFO: task java: xxx blocked for more than 120 seconds.” 的3种解决方案
1 问题描述 最近搭建的一个linux最小系统在运行到241秒时在控制台自动打印如下图信息,并且以后每隔120秒打印一次. 仔细阅读打印信息发现关键信息是“hung_task_timeout_secs ...
- INFO: task java:27465 blocked for more than 120 seconds不一定是cache太大的问题
这几天,老有几个环境在中午收盘后者下午收盘后那一会儿,系统打不开,然后过了一会儿,进程就消失不见了,查看了下/var/log/message,有如下信息: Dec 12 11:35:38 iZ23nn ...
- task mysqld:26208 blocked for more than 120 seconds
早上10点左右,某台线上ECS服务器突然没响应. 查看日志,发现如下信息: Aug 14 03:26:01 localhost rsyslogd: [origin software="rsy ...
- 服务器卡死,重启报错: INFO: task blocked for more than 120 seconds
问题:服务器负载很高,但是CPU利用率不高.服务器经常夯住,网站打不开,SSH连接非常不稳定,输入命令夯住. 重启服务器报错: INFO: task blocked for more than 120 ...
随机推荐
- Windows Subsystem for Linux(wsl)使用
由于项目有一些环境需要在linux环境运行.可用微软win10的WSL来搭配使用 安装wsl 控制面板--程序和功能--启用或关闭windows功能,适用于linux的windows系统 应用商城下载 ...
- Redis--hash类型操作命令
哈希类型hash redis hash 是一个 string 类型的 field 和 value 的映射表,hash 特别适合用于存储对象 哈希类型hash——基本命令 hset /hget /hms ...
- SSL 杂谈
在电子邮件系统中的开发和维护中,由于安全性的需要,经常会遇到 SSL 相关的问题,这里整理下 SSL 的一些基础知识 什么是 SSL SSL (Secure Sockets Layer) 是一种在应用 ...
- 如何使用Cloud Foundry CLI把一个应用推送到MindSphere
一.登录MindSphere - Cloud Foundry 1. 安装Cloud Foundry CLI (Command Line Interface). 下载地址:https://github. ...
- Gitlab Runner实现CI/CD自动化部署asp.net core应用
环境说明 一台git服务器(192.168.169.7),安装gitlab,docker. 一台web服务器(192.168.169.6),安装git,gitlab runner,docker,dot ...
- python的excel处理之openpyxl
一.颜色处理 cell = sheet.cell(row, col)font = Font(size=12, bold=False, name='Arial', color=colors.BLACK) ...
- canvas 绘制动态圆环进度条
由于使用的是vue开发,所以就展示一下绘制函数好了,上图是效果图 drawMain(drawing_elem, percent, forecolor, bgcolor) { /* @drawing_e ...
- 三种JS截取字符串方法
JS提供三个截取字符串的方法,分别是:slice(),substring()和substr(),它们都可以接受一个或两个参数: var stmp = "rcinn.cn"; 使用一 ...
- sql server 2012 分页/dapper/C#拼sql/免储存过程/简易
sql server 2012新特性, 支持 OFFSET/FETCH分页, 就像mysql的limit, 比之前的各种top舒服多了, 看各位大佬们的测评文章说效率也是不相上下的, 有时候写个小工 ...
- 如何把SAP Kyma和SAP Cloud for Customer连接起来
首先进入SAP Cloud for Customer的Administration的工作中心,打开General Settings视图,进入Event Notification配置UI: 新建一个C4 ...