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

[fix] Wait for run_lock when freeing it #4195

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion web/server/codechecker_server/api/mass_store_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,15 @@ def __free_run_lock(self, session: DBSession):
""" Remove the lock from the database for the given run name. """
# Using with_for_update() here so the database (in case it supports
# this operation) locks the lock record's row from any other access.
# The "nowait" option is turned off, because it results a 'could not
# obtain lock on row in relation "run_locks"' error message in case
# this query happens simultaneously with a concurrent locking of
# another parallel store event. With "nowait" option the query will be
# blocked until the lock is undone. In the worst case when
# statement_timeout is reached, the exception will be thrown anyway.
run_lock = session.query(RunLock) \
.filter(RunLock.name == self.__name) \
.with_for_update(nowait=True).one()
.with_for_update(nowait=False).one()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should only this one usage site be modified?

session.delete(run_lock)
session.commit()

Expand Down