From ecfa7766b5cc76d79db03bd8233ab65d11a2d4ea Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Thu, 26 Jun 2025 00:18:52 -0400 Subject: [PATCH] fix a separate race case In a very close race, one side can first see the duplicate nvr during the get_build check in new_build, which leads to an attempt to recycle, which fails because the duplicate is in the BUILDING state. --- kojihub/kojihub.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index 67db4ec7..f62949b0 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -4861,8 +4861,9 @@ def get_next_build(build_info): for try_no in range(2, 10): savepoint = Savepoint('get_next_build_pre_insert') try: - return new_build(build_info) - except IntegrityError: + # using strict so we don't try to recycle + return new_build(build_info, strict=True) + except (IntegrityError, koji.GenericError): savepoint.rollback() build_info['release'] = get_next_release(build_info, try_no) # otherwise