diff options
author | Mateusz Moscicki <m.moscicki2@partner.samsung.com> | 2020-05-21 11:28:12 +0200 |
---|---|---|
committer | Mateusz Moscicki <m.moscicki2@partner.samsung.com> | 2020-05-22 17:00:53 +0200 |
commit | 2e0967997638af18d9d889c8d7ab0dc5b5eb1c72 (patch) | |
tree | 07ae75a62683698ca3e75ee5f117add6b3b207f8 | |
parent | 15235987ab323f59442d6b380a19370e43310d9a (diff) | |
download | crash-worker-2e0967997638af18d9d889c8d7ab0dc5b5eb1c72.tar.gz crash-worker-2e0967997638af18d9d889c8d7ab0dc5b5eb1c72.tar.bz2 crash-worker-2e0967997638af18d9d889c8d7ab0dc5b5eb1c72.zip |
Add option to release the crashed process as soon as possible
Change-Id: Idd951c4b8c50ba1e29524339358475acdbacd382
-rw-r--r-- | src/crash-manager/crash-manager.c | 34 | ||||
-rw-r--r-- | src/crash-manager/crash-manager.conf | 8 | ||||
-rw-r--r-- | src/shared/config.c | 8 | ||||
-rw-r--r-- | src/shared/config.h | 2 |
4 files changed, 38 insertions, 14 deletions
diff --git a/src/crash-manager/crash-manager.c b/src/crash-manager/crash-manager.c index ddd38cc..ea4c3b7 100644 --- a/src/crash-manager/crash-manager.c +++ b/src/crash-manager/crash-manager.c @@ -1251,6 +1251,23 @@ void crash_info_init(struct crash_info *cinfo) cinfo->lock_fd = -1; } +static void release_crashed_process() +{ + /* Release the core pipe as passed by kernel, allowing another + * coredump to be handled. + * + * Due to usage of core_pipe_limit there is limited number of + * crash-manager processes that kernel is going to invoke + * concurrently. As the next and last step is a _synchronous_ + * call to crash-popup we close the descriptor here. + * + * Note: for VIP processes this will likely cause the system + * to reboot without showing popup. + */ + close(STDIN_FILENO); + _I("Released crashed process lock"); +} + static bool run(struct crash_info *cinfo) { /* Execute processes in parallel */ @@ -1277,6 +1294,9 @@ static bool run(struct crash_info *cinfo) return false; } + if (!cinfo->livedump && config.release_early) + release_crashed_process(); + char *temp_report; if (config.report_type >= REP_TYPE_FULL) { /* Save shared objects info (file names, bulid IDs, rpm package names) */ @@ -1304,18 +1324,8 @@ static bool run(struct crash_info *cinfo) printf("REPORT_PATH=%s\n", cinfo->result_path); if (!cinfo->livedump) { - /* Release the core pipe as passed by kernel, allowing another - * coredump to be handled. - * - * Due to usage of core_pipe_limit there is limited number of - * crash-manager processes that kernel is going to invoke - * concurrently. As the next and last step is a _synchronous_ - * call to crash-popup we close the descriptor here. - * - * Note: for VIP processes this will likely cause the system - * to reboot without showing popup. - */ - close(STDIN_FILENO); + if (!config.release_early) + release_crashed_process(); launch_dbus_notify(cinfo); diff --git a/src/crash-manager/crash-manager.conf b/src/crash-manager/crash-manager.conf index 09f3926..d1f58af 100644 --- a/src/crash-manager/crash-manager.conf +++ b/src/crash-manager/crash-manager.conf @@ -5,6 +5,14 @@ MaxRetentionSec=0 MaxCrashDump=0 AllowZip=yes +# Release process before report completion (default - no) +# This option determines whether the crashing process should be released +# immediately after reading the necessary data from /proc/<PID>/ to allow the +# process to be cleaned up. This is important for VIP processes because if they +# are cleaned up too early, the device will be rebooted before the full report +# is written. +# ReleaseProcessLockEarly=no + # Crash report path must exist for the reports to be created # CrashRootPath=/usr/opt/share/crash/ diff --git a/src/shared/config.c b/src/shared/config.c index 60f168e..947095f 100644 --- a/src/shared/config.c +++ b/src/shared/config.c @@ -154,6 +154,7 @@ static bool config_load_from_dict(config_t *c, const dictionary *ini) UPDATE(c->dump_so_info, boolean, "DumpSharedObjectInfo"); UPDATE(c->allow_zip, boolean, "AllowZip"); UPDATE(c->legacy_notification, boolean, "UseLegacyNotification"); + UPDATE(c->release_early, boolean, "ReleaseProcessLockEarly"); #undef UPDATE @@ -251,6 +252,7 @@ static bool config_apply_defaults(config_t *c) c->dump_so_info = DUMP_SO_INFO; c->allow_zip = ALLOW_ZIP; c->legacy_notification = LEGACY_NOTIFICATION; + c->release_early = RELEASE_EARLY; return c->crash_root_path != NULL; } @@ -269,7 +271,8 @@ static void config_dump(config_t *c) "config: dump_core = %d\n" "config: dump_so_info = %d\n" "config: allow_zip = %d\n" - "config: legacy_notification = %d\n", + "config: legacy_notification = %d\n" + "config: release_early = %d\n", c->crash_root_path, c->extra_script, report_type_to_str(c->report_type), @@ -280,7 +283,8 @@ static void config_dump(config_t *c) c->dump_core, c->dump_so_info, c->allow_zip, - c->legacy_notification); + c->legacy_notification, + c->release_early); } bool config_init(config_t *c, const char *const path) diff --git a/src/shared/config.h b/src/shared/config.h index 00b71b7..a50c437 100644 --- a/src/shared/config.h +++ b/src/shared/config.h @@ -29,6 +29,7 @@ #define DUMP_SO_INFO 1 #define ALLOW_ZIP 1 #define LEGACY_NOTIFICATION 0 +#define RELEASE_EARLY 0 #define CRASH_SECTION "CrashManager" #define EXCLUDEPATHS_SECTION "ExcludePaths" @@ -45,6 +46,7 @@ typedef struct config { bool dump_core; bool dump_so_info; bool legacy_notification; + bool release_early; enum ReportType report_type; int system_max_use; int system_keep_free; |