This is an automated email from the ASF dual-hosted git repository.

kenhuuu pushed a commit to branch tx-idle-to
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 301f820a74a9646205d4fdab03c9e6a1332177d8
Author: Ken Hu <[email protected]>
AuthorDate: Thu Jun 25 17:34:57 2026 -0700

    add fix to prevent accidental setting of timeout
---
 .../tinkerpop/gremlin/server/transaction/UnmanagedTransaction.java  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/transaction/UnmanagedTransaction.java
 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/transaction/UnmanagedTransaction.java
index 367e8f963b..c462dfa41b 100644
--- 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/transaction/UnmanagedTransaction.java
+++ 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/transaction/UnmanagedTransaction.java
@@ -222,6 +222,12 @@ public class UnmanagedTransaction {
                 close(false);
             }, idleTimeout, TimeUnit.MILLISECONDS);
         });
+
+        // The accepting check above and the arm below are not atomic: a 
concurrent close() could have flipped
+        // accepting=false and cancelled idleFuture in between, leaving the 
timer we just armed orphaned (it would fire
+        // ~idleTimeout later and call close() on an already-gone 
transaction). Re-check after arming and cancel if so,
+        // so the "never re-arm a dying transaction" invariant actually holds.
+        if (!accepting.get()) cancelIdleTimer();
     }
 
     /**

Reply via email to