public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jakub Jelen <jjelen@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/kryoptic] rawhide: Fix deadlock during parallel testsuite run (#2504228)
Date: Wed, 22 Jul 2026 09:45:47 GMT [thread overview]
Message-ID: <178471354799.1.15528274791381906483.rpms-kryoptic-2ac0041a50ce@fedoraproject.org> (raw)
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
reply other threads:[~2026-07-22 9:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178471354799.1.15528274791381906483.rpms-kryoptic-2ac0041a50ce@fedoraproject.org \
--to=jjelen@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox