[RHEL^ ABRT PATCH] abrt-dump-oops: limit amount of created dirs, add cooldown sleep if exceeded. rhbz#952773

Jiri Moskovcak jmoskovc at redhat.com
Fri Jun 14 08:08:35 UTC 2013


Thanks, pushed. Please update the bugzilla and write a test for this fix 
(ticket https://github.com/abrt/abrt/issues/663)

Thank you,
Jirka

On 06/12/2013 02:33 PM, Denys Vlasenko wrote:
> This is a partial backport of 6fc121f145354dd95bb588eb685f1593f5156ca0.
>
> Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>
> ---
>   src/plugins/abrt-dump-oops.c | 17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
> index 85ca2c0..0dbe7fe 100644
> --- a/src/plugins/abrt-dump-oops.c
> +++ b/src/plugins/abrt-dump-oops.c
> @@ -21,6 +21,11 @@
>   #include <sys/inotify.h>
>   #include "libabrt.h"
>
> +/* How many problem dirs to create at most?
> + * Also causes cooldown sleep if exceeded -
> + * useful when called from a log watcher.
> + */
> +#define MAX_DUMPED_DD_COUNT  5
>
>   static bool world_readable_dump = false;
>   static const char *debug_dumps_dir = ".";
> @@ -110,8 +115,8 @@ static int scan_syslog_file(GList **oops_list, int fd, struct stat *statbuf, int
>   /* returns number of errors */
>   static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
>   {
> -    unsigned countdown = 16; /* do not report hundreds of oopses */
> -    unsigned idx = 0; //oops_cnt;
> +    unsigned countdown = MAX_DUMPED_DD_COUNT + 1; /* do not report hundreds of oopses */
> +    unsigned idx = 0;
>
>       VERB1 log("Saving %u oopses as dump dirs", oops_cnt >= countdown ? countdown-1 : oops_cnt);
>
> @@ -207,6 +212,14 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
>
>       free(cmdline_str);
>
> +    /* This delays log rescan
> +     * and possibly prevents dreaded "abrt storm".
> +     */
> +    if (oops_cnt > MAX_DUMPED_DD_COUNT)
> +    {
> +        sleep(oops_cnt - MAX_DUMPED_DD_COUNT);
> +    }
> +
>       return errors;
>   }
>
>



More information about the Crash-catcher mailing list