diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-07 22:42:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-08 00:35:29 +0200 |
commit | 2bf3a263c5a9cecf47824acba6a927e179fc36f4 (patch) | |
tree | 9f9c67464b1c493b7a76158f63e6ca3f980ce1b1 /Userland/Services/CrashDaemon/main.cpp | |
parent | 98e878ab3b4c664f90b514ffc8320e03d9cf6f68 (diff) | |
download | serenity-2bf3a263c5a9cecf47824acba6a927e179fc36f4.zip |
CrashDaemon: Stop automatically compressing coredumps
This was a nice idea in theory, but in practice it makes big crashes
(e.g WebContent) even more CPU intensive. Let's disable this for now
(but keep the ability for CrashReporter to open compressed coredumps.)
Diffstat (limited to 'Userland/Services/CrashDaemon/main.cpp')
-rw-r--r-- | Userland/Services/CrashDaemon/main.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/Userland/Services/CrashDaemon/main.cpp b/Userland/Services/CrashDaemon/main.cpp index 54238933d0..120c5fd5de 100644 --- a/Userland/Services/CrashDaemon/main.cpp +++ b/Userland/Services/CrashDaemon/main.cpp @@ -7,12 +7,7 @@ #include <AK/LexicalPath.h> #include <AK/MappedFile.h> #include <Kernel/API/InodeWatcherEvent.h> -#include <LibCompress/Gzip.h> -#include <LibCore/ElapsedTimer.h> -#include <LibCore/File.h> #include <LibCore/FileWatcher.h> -#include <LibCoredump/Backtrace.h> -#include <LibCoredump/Reader.h> #include <serenity.h> #include <spawn.h> #include <sys/stat.h> @@ -34,27 +29,6 @@ static void wait_until_coredump_is_ready(const String& coredump_path) } } -static bool compress_coredump(String const& coredump_path, NonnullRefPtr<MappedFile> coredump_file) -{ - auto compressed_coredump = Compress::GzipCompressor::compress_all(coredump_file->bytes()); - if (!compressed_coredump.has_value()) { - dbgln("Could not compress coredump '{}'", coredump_path); - return false; - } - auto output_path = String::formatted("{}.gz", coredump_path); - auto output_file_or_error = Core::File::open(output_path, Core::OpenMode::WriteOnly); - if (output_file_or_error.is_error()) { - dbgln("Could not open '{}' for writing: {}", output_path, output_file_or_error.error()); - return false; - } - auto output_file = output_file_or_error.value(); - if (!output_file->write(compressed_coredump.value().data(), compressed_coredump.value().size())) { - dbgln("Could not write compressed coredump '{}'", output_path); - return false; - } - return true; -} - static void launch_crash_reporter(const String& coredump_path, bool unlink_after_use) { pid_t child; @@ -95,8 +69,6 @@ int main() if (event.value().type != Core::FileWatcherEvent::Type::ChildCreated) continue; auto& coredump_path = event.value().event_path; - if (coredump_path.ends_with(".gz")) - continue; // stops compress_coredump from accidentally triggering us dbgln("New coredump file: {}", coredump_path); wait_until_coredump_is_ready(coredump_path); @@ -107,15 +79,5 @@ int main() } launch_crash_reporter(coredump_path, true); - - // FIXME: This is a hack to give CrashReporter time to parse the coredump - // before we start compressing it. - // I'm sure there's a much smarter approach to this whole thing, - // and we should find it. :^) - sleep(3); - - auto compress_timer = Core::ElapsedTimer::start_new(); - if (compress_coredump(coredump_path, file_or_error.release_value())) - dbgln("Compressing coredump took {} ms", compress_timer.elapsed()); } } |