Skip to content

Don't pick .lock'd and new dirs for deletion when problem dirs grow over size limit - #629

Merged
mgrabovsky merged 4 commits into
abrt:masterfrom
michalfabik:check-problem-dir-lock
May 13, 2020
Merged

mgrabovsky merged 4 commits into
abrt:masterfrom
michalfabik:check-problem-dir-lock

Conversation

@michalfabik

@michalfabik michalfabik commented May 4, 2020 •

Copy link
Copy Markdown
Contributor

See commits.

Resolves abrt/abrt#1450.

See also abrt/abrt#1481

@mgrabovsky mgrabovsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: First commit message has a typo ("dirzise").

Comment thread src/lib/dirsize.c Resolved
@michalfabik
michalfabik force-pushed the check-problem-dir-lock branch 2 times, most recently from 03acec6 to cdedf96 Compare May 7, 2020 16:25
Comment thread src/lib/dirsize.c Resolved
Comment thread src/lib/dirsize.c Resolved
Comment thread src/lib/dirsize.c Outdated
{
log_warning("Skipping %s: directory locked. Is a backtrace being generated?", dname);
double sz = libreport_get_dirsize(dname);
size += sz;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed if we’re skipping the directory? I’m looking at the sosreport-still-being-generated case above and it doesn’t do that.

@michalfabik michalfabik May 12, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the directory's size still counts to the total size of the directory where problem directories are stored (/var/spool/abrt), even if we're skipping it for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. Do you think we should do the same above, then?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we would fold the two cases into yours, but that might be more involved, given that sosreport generation comes from an event handler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. Do you think we should do the same above, then?

Yeah, makes sense to me.

When trimming problem directories to MaxCrashReportsSize as a result
of a new problem being detected whose directory exceeds the limit,
skip direcories that have been .lock'd by abrt-action-generate-backtrace
or abrt-action-generate-core-backtrace

Signed-off-by: Michal Fabik <[email protected]>
When trimming the problem directories, dirs get skipped if a sosreport
is being generated in them. However, the dir size still needs to be
counted towards the total size limit, even if the dir can't be picked
for deletion right now.

Signed-off-by: Michal Fabik <[email protected]>
Add an argument to libreport_get_dirsize_find_largest_dir containing
the problem directory that triggered the trimming of problem dirs.
Make sure the newly reported problem dir doesn't get picked for deletion
in case it happens to make /var/spool/abrt size grow over
MaxCrashReportsSize.

Signed-off-by: Michal Fabik <[email protected]>
@michalfabik
michalfabik force-pushed the check-problem-dir-lock branch from cdedf96 to 20fff7a Compare May 13, 2020 08:16
Comment thread src/lib/dirsize.c Resolved
Signed-off-by: Michal Fabik <[email protected]>
@michalfabik
michalfabik force-pushed the check-problem-dir-lock branch from 1bdaecd to 5a3821d Compare May 13, 2020 09:04
Comment thread src/lib/dirsize.c
maxsz = sz;
free(*worst_dir);
*worst_dir = libreport_xstrdup(ep->d_name);
if (!proc_dir || strcmp(proc_dir, ep->d_name) != 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could fold this into an else if and save some horizontal whitespace.

@ernestask

Copy link
Copy Markdown
Collaborator

Looks good to me overall.

@mgrabovsky mgrabovsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well.

@mgrabovsky
mgrabovsky merged commit 759d90b into abrt:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ABRT deletes core dumps far too aggressively, even while user is trying to report the crash

3 participants