public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/kryoptic] rawhide: Fix deadlock during parallel testsuite run (#2504228)
@ 2026-07-22  9:45 Jakub Jelen
  0 siblings, 0 replies; only message in thread
From: Jakub Jelen @ 2026-07-22  9:45 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/kryoptic
            Branch : rawhide
            Commit : 2ac0041a50ce84aad8caea840379078caec4963e
            Author : Jakub Jelen <jjelen@redhat.com>
            Date   : 2026-07-22T11:45:16+02:00
            Stats  : +58/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/kryoptic/c/2ac0041a50ce84aad8caea840379078caec4963e?branch=rawhide

            Log:
            Fix deadlock during parallel testsuite run (#2504228)

Fixes FTBFS bug #2504228

---
diff --git a/kryoptic-fix-deadlock.patch b/kryoptic-fix-deadlock.patch
new file mode 100644
index 0000000..4a6c7a5
--- /dev/null
+++ b/kryoptic-fix-deadlock.patch
@@ -0,0 +1,56 @@
+From 9dbf68e12ab06c7171c83e6f34d8a4b50605f09a Mon Sep 17 00:00:00 2001
+From: Simo Sorce <simo@redhat.com>
+Date: Mon, 6 Jul 2026 12:50:02 -0400
+Subject: [PATCH] Prevent test deadlocks in synchronization
+
+Replaced the blocking `write()` lock acquisition on the SYNC primitive with a
+polling loop using `try_write()` and a short sleep. A queued write lock could
+block incoming `read()` attempts, leading to deadlocks during test
+finalization. Using `try_write()` ensures that pending reads can complete
+safely.
+
+Signed-off-by: Simo Sorce <simo@redhat.com>
+---
+ src/tests/mod.rs | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/tests/mod.rs b/src/tests/mod.rs
+index 5f4e576..292fbd7 100644
+--- a/src/tests/mod.rs
++++ b/src/tests/mod.rs
+@@ -5,6 +5,8 @@ use std::ffi::CString;
+ use std::fs::{create_dir_all, remove_dir_all, OpenOptions};
+ use std::io::Write;
+ use std::sync::Once;
++use std::thread;
++use std::time::Duration;
+ 
+ #[cfg(feature = "log")]
+ use crate::log;
+@@ -198,8 +200,22 @@ impl TestToken<'_> {
+             drop(FINI.read().unwrap());
+         } else {
+             self.sync = None;
++
+             /* wait for all others to complete */
+-            drop(SYNC.write().unwrap());
++            loop {
++                /* This needs to use try_write() because a queued write lock
++                 * may actually block read() attempts, which would cause
++                 * tests to deadlock, sleeps between attempts. */
++                thread::sleep(Duration::from_millis(5));
++                match SYNC.try_write() {
++                    Ok(lock) => {
++                        drop(lock);
++                        break;
++                    }
++                    Err(_) => (),
++                }
++            }
++
+             let ret = fn_finalize(std::ptr::null_mut());
+             assert_eq!(ret, CKR_OK);
+             /* winner finalized and completed the tests */
+-- 
+2.55.0
+

diff --git a/kryoptic.spec b/kryoptic.spec
index 56ef590..79312af 100644
--- a/kryoptic.spec
+++ b/kryoptic.spec
@@ -37,6 +37,8 @@ Source2:        https://people.redhat.com/~ssorce/simo_redhat.asc
 # * Update quick-xml dependency to 0.41:
 #   https://github.com/latchset/kryoptic/pull/475
 Patch:          kryoptic-fix-metadata.diff
+# https://github.com/latchset/kryoptic/pull/476
+Patch:          kryoptic-fix-deadlock.patch
 
 
 BuildRequires:  cargo-rpm-macros >= 26

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-22  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-22  9:45 [rpms/kryoptic] rawhide: Fix deadlock during parallel testsuite run (#2504228) Jakub Jelen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox