From 73f26e1542abbff12aebc6386f2b59763fb32806 Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Wed, 8 Jul 2026 17:41:55 +0300 Subject: [PATCH] Use notifyAll in IOTaskRunnable.kick (CodeQL java/notify-instead-of-notify-all) kick() woke a waiter with notify(). Today there is only ever a single waiter - the one background thread per IOTaskRunnable that blocks in run()'s wait() - so notify() and notifyAll() are equivalent, but notify() is fragile: if another thread ever waited on the same monitor, notify() could wake the wrong one. Switch to notifyAll(). It wakes the same single waiter now (no thundering herd), and the wait loop already re-checks its conditions (shouldStop / _notified / recomputed wait time), so any extra wake-ups are handled safely. --- persistit/core/src/main/java/com/persistit/IOTaskRunnable.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persistit/core/src/main/java/com/persistit/IOTaskRunnable.java b/persistit/core/src/main/java/com/persistit/IOTaskRunnable.java index a1d0ba57c..7230cc993 100644 --- a/persistit/core/src/main/java/com/persistit/IOTaskRunnable.java +++ b/persistit/core/src/main/java/com/persistit/IOTaskRunnable.java @@ -14,6 +14,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * Portions Copyrighted 2026 3A Systems, LLC */ package com.persistit; @@ -64,7 +65,7 @@ Thread getThread() { synchronized void kick() { if (!_notified) { _notified = true; - notify(); + notifyAll(); } }