linux abrtd是一個守護程序監控的應用程式崩潰;當發生崩潰時,它將收集的崩潰application ,並採取措施根據類型崩潰abrt.conf config文件中的配置中,位於“/etc /abrt」目錄下的有其配置「abrt.conf」等。
本教學操作環境:linux5.9.8系統、Dell G3電腦。
abrtd服務佔滿系統資源?
咱們開發環境的有一個流程特別耗資源,能幫分析下原因嗎?之前場內和公有雲也出現過幾次,最後這個進程會把機器記憶體打滿宕機。現在剛好發現這個問題現場
對於進程跑滿的現象第一件事就是看一下進程名,目測一下結束了,第一次見
top -pH 48297 看一下具體進程中的哪一個執行緒有問題發現只有一個行程沒有執行緒
ps看一下這個服務的目錄在哪
[root@yq01-kg-section1-bud3 libexec]# ps -ef | grep abrt-hook-ccpp root 45733 11797 0 12:18 pts/8 00:00:00 grep --color=auto abrt-hook-ccpp root 48297 2 99 Nov16 ? 15:42:50 /usr/libexec/abrt-hook-ccpp 11 0 8669 0 0 1605530067 e 8669 8669
毫無頭緒! !開始百度搜到如下
abrtd 是一個守護程序監控的應用程式崩潰.當發生崩潰時,它將收集的崩潰(核心檔案的命令行, etc .)application ,並採取措施根據類型崩潰並根據abrt.conf config 文件中的配置中.有插件的各種動作:例如bugzilla 報表的崩潰,將該報表.通過ftp 傳輸或報表或scp .請查看手冊頁的相應的插件.
abrtd: automatically bug report daemon. 自動的bug 報告守護程序
linux調試程序,最痛苦的就是程序異常宕掉,但是找不到core文件,很難定位問題。但是有了core檔就容易定位多了。
一般是可以透過在環境變數中設定ulimit -c unlimited。但是現場實施人員有時會忘記設定這條命令。那怎麼辦呢,可以透過設定linux的abrt服務來實現。
修改abrt-action-save-package-data.conf檔案
將其修改為:
vi /etc/abrt/abrt-action-save-package-data.conf # With this option set to "yes", # only crashes in signed packages will be analyzed. # the list of public keys used to check the signature is # in the file gpg_keys # OpenGPGCheck = no # Blacklisted packages # BlackList = nspluginwrapper, valgrind, strace, mono-core # Process crashes in executables which do not belong to any package? # ProcessUnpackaged = yes # Blacklisted executable paths (shell patterns) # BlackListedPaths = /usr/share/doc/, /example*, /usr/bin/nspluginviewer, /usr/lib/xulrunner-*/plugin-container 还可以调整core文件的大小: [root@xx-host2 abrt]# cat abrt.conf # Enable this if you want abrtd to auto-unpack crashdump tarballs which appear # in this directory (for example, uploaded via ftp, scp etc). # Note: you must ensure that whatever directory you specify here exists # and is writable for abrtd. abrtd will not create it automatically. # #WatchCrashdumpArchiveDir = /var/spool/abrt-upload # Max size for crash storage [MiB] or 0 for unlimited # MaxCrashReportsSize = 1000 # Specify where you want to store coredumps and all files which are needed for # reporting. (default:/var/spool/abrt) # # Changing dump location could cause problems with SELinux. See man abrt_selinux(8). # #DumpLocation = /var/spool/abrt # If you want to automatically clean the upload directory you have to tweak the # selinux policy. # DeleteUploaded = no
重啟abrtd 服務: service abrtd restart
有了core檔案也需要及時刪除,透過abrt-cli list查看文件的包,然後用abrt-cli rm 【文件包】就可以了。
遇到程式崩潰的時候abrt-hook-ccpp使用CPU太多,IO也太高導致系統跑滿了,乾脆停用算了
systemctl stop abrt-ccpp.service
systemctl disable abrt-ccpp.service
systemctl status abrt-ccpp.service
查了一下systemctl status abrt-ccpp.service發現根本就沒有起這個服務
再百度
#usr/libexec/abrt-hook-ccpp為什麼這個程序一直在增加
sed -i 's/ProcessUnpackaged = no/ProcessUnpackaged = yes/g' /etc/abrt/abrt-action-save-package-data.conf&& service abrtd restart
Nov 17 13:15:15 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297 Nov 17 13:15:15 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297 Nov 17 13:15:16 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297 Nov 17 13:15:16 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297 Nov 17 13:15:17 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297 Nov 17 13:15:17 yq01-kg-section1-bud3 systemd: abrtd.service stop-sigterm timed out. Killing. Nov 17 13:15:17 yq01-kg-section1-bud3 systemd: abrtd.service: main process exited, code=killed, status=9/KILL Nov 17 13:15:17 yq01-kg-section1-bud3 systemd: Unit abrtd.service entered failed state. Nov 17 13:15:17 yq01-kg-section1-bud3 systemd: abrtd.service failed. Nov 17 13:15:17 yq01-kg-section1-bud3 abrtd: Lock file '.lock' is locked by process 48297
kill -9 48297
top重新看一下進程喔耶!
推薦學習:《linux影片教學
》以上是linux abrtd 是什麼服務的詳細內容。更多資訊請關注PHP中文網其他相關文章!