Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that the Number of runs is displayed correctly #4242

Merged
merged 1 commit into from
May 27, 2024

Conversation

noraz31
Copy link
Collaborator

@noraz31 noraz31 commented May 16, 2024

In some rare cases, when an error occurs while deleting
runs, the number of runs to be deleted is deducted from
the "Number of runs" value displayed in the
"Products" view, even though some runs do not get
deleted. For this reason, the number of runs could go
negative upon the next run deletion.
This change is to fix this issue.

@noraz31 noraz31 requested review from bruntib and vodorok as code owners May 16, 2024 09:33
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

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

I think silently suppressing the generic exception object is never a good idea. Maybe there are exceptions (hehe), but this just isn't it in my view.

web/server/codechecker_server/api/report_server.py Outdated Show resolved Hide resolved
@noraz31 noraz31 force-pushed the fix_number_of_runs branch 2 times, most recently from 048b22c to db38d84 Compare May 16, 2024 10:26
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

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

I'd be thrilled to learn what kind of exceptions can come out of here, but also submit to the fact we can't just blindly release them first. LGTM.

@@ -3424,10 +3424,24 @@ def removeRun(self, run_id, run_filter):
# cascades and such. Deleting runs in separate transactions don't
# exceed a potential statement timeout threshold in a DBMS.
runs = []
run_no = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure run_no is a clear variable name. Maybe deleted_run_cnt or something else would be better.

# counter is not affected by the exception.
LOG.warning(f"Suppressed an exception while "
f"deleting run {run.name}. Error: {e}")
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary pass statement.

# expected to never occur, but there have been some rare
# cases where it occurred due to underlying reasons.
# Handling it silently ensures that the Number of runs
# counter is not affected by the exception.
Copy link
Contributor

Choose a reason for hiding this comment

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

One reason of the exception can be an SQL statement timeout while a too large run is being deleted. We should include another TODO here which suggests the catching of SQLAlchemyError instead of the generic Exception when we can make this sure based on the warnings messages below, in the server logs.

In some rare cases, when an error occurs while deleting
runs, the number of runs to be deleted is deducted
from the "Number of runs" value displayed in the
"Products" view, even though some runs do not get
deleted. For this reason, the number of runs could
go negative upon the next run deletion.
This change is to fix this issue.
@noraz31 noraz31 force-pushed the fix_number_of_runs branch from db38d84 to 3abcb42 Compare May 27, 2024 11:11
@bruntib bruntib added this to the release 6.24.0 milestone May 27, 2024
@bruntib bruntib merged commit 5fa993e into Ericsson:master May 27, 2024
7 of 8 checks passed
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.

4 participants