为什么gnome-shell
每秒会将 17783 行错误写入我的/var/log/syslog
文件?:
gnome-shell: ERROR:broker_posix.cc(46)] Received unexpected number of handles
gnome-shell: ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
细节:
今天早上我的电脑警告我磁盘空间不足,所以我用rm -rf ~/.local/share/Trash/*
。运行df -h
显示我的根驱动器上有 20 GB 的可用空间。
然后我把电脑放了几个小时。
令我惊讶的是,当我最近重新使用它时,它又降到了 0 MB 可用空间!发生了什么?
运行后,sudo ncdu /
我可以扫描并查看磁盘使用情况,我发现/var/log/syslog
文件大小为 43.5 GiB。可能是这个吗?这个日志是否突然增长得非常快,填满了我刚刚释放的 20 GB 空间?什么写入了这个日志文件?为什么?它通常会自动旋转,还是自我限制到某个最大大小?应该吗?
运行less /var/log/syslog
结果如下:
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711106:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711119:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711219:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711232:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711331:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711344:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711445:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711459:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711560:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711573:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711673:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711687:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711787:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711801:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711902:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711917:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712018:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712031:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712131:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712144:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712246:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712260:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712361:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.712374:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
如你所见,有很多行这样的代码:
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711106:ERROR:broker_posix.cc(46)] Received unexpected number of handles
Jul 16 00:06:09 gabriel-Latitude-7490 gnome-shell[503208]: [503636:1:0100/000000.711119:ERROR:command_buffer_proxy_impl.cc(96)] ContextResult::kFatalFailure: AllocateAndMapSharedMemory failed
为什么?
然后我跑了:
head -n 100000 /var/log/syslog > ~/sysloghead.txt
它创建了一个 17.2 MB 的文件,我可以用 Sublime Text 等文本编辑器打开它。扫描文件显示它正在写入每 17783 行第二! 上面两行是 344 字节 + 换行符 = 346 字节,因此相当于 17783/2*346 = 3076459 字节/秒 =3.076459 MB/秒。
20 GB = 20000 MB / 3.076459 Mb/秒 = 6500 秒 / 3600 秒/小时 =1.8 小时按照这个速度,我需要 1.8 小时才能用完我释放的 20 GB。
那么,发生了什么事?这是个什么错误?这是导致我的磁盘空间突然填满的原因吗?还是我中了病毒?据我所知,我以前从未在 Linux 中遇到过病毒,自 2018 年以来,我一直在家中和工作中使用 Ubuntu 作为我的主要操作系统。
我需要恢复我的空间。我可以删除/var/log/syslog
以释放 44 GB 的空间吗?
我不确定这是否是 gnome-shell 错误,但我刚刚在这里报告了它:https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5662
答案1
更新:此错误已于 2022 年 7 月 26 日星期二 20:37:31 修复。请参阅此评论回复了我的错误报告并且在这里提交:c565dd300a910b199ddef6ea83dcf4a3414525bf。请更新您的基于 Chromium 的浏览器。
首先,我重新启动以终止并重新启动疯狂记录的进程。
接下来,我不知道这是否不好,但我只是将我的 syslog 文件截断为 1 GB 以释放 43 GB 的空间,如下所示:
sudo truncate -s 1G /var/log/syslog
我确实需要那个自由空间。
gnome-shell
我还在此处报告了可能存在的错误的日志消息:https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5662
事实证明这是 Chrome 错误,然而,不是 gnome-shell
错误。它们之所以出现,显然gnome-shell
是因为gnome-shell
Chrome 是启动它的。请参阅打印错误的实际源代码:
- 第 46 行:https://chromium.googlesource.com/chromium/src/+/HEAD/mojo/core/broker_posix.cc#46
- 第 96-97 行: https://chromium.googlesource.com/chromium/src/gpu/+/master/ipc/client/command_buffer_proxy_impl.cc#96
我刚刚向 Google Chromium 团队报告了这个问题:问题 1345116:broker_posix.cc:46 和 command_buffer_proxy_impl.cc:96 每秒最多记录 17783 行,数小时内就填满整个磁盘!
我通过以下方式将其发送给了 Google Chrome 团队:click 3 dots in the top-right corner of the Chrome browser
--> Help
--> Report an Issue...
:
Broker_posix.cc 第 46 行和 Command_buffer_proxy_impl.cc 第 96 行的 Chromium 日志行每秒最多记录 17783 行,数小时内填满整个磁盘!请限制日志记录。看:https://bugs.chromium.org/p/chromium/issues/detail?id=1345116