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為什麼這個程序一直在增加
因為無法建立ccpp檔案導致的
需要修改/etc/abrt/abrt-action-save-package-data.conf中ProcessUnpackaged引數。
修改/etc/abrt/abrt-action-save-package-data.conf中ProcessUnpackaged引數
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 abrtd 是什麼服務的詳細內容,更多請關注TW511.COM其它相關文章!