Skip to content

Commit 78e2ab8

Browse files
aksOpsclaude
andcommitted
fix: synchronize SQLite cache for virtual thread safety
AnalysisCache.storeResults() called from multiple virtual threads concurrently caused "cannot commit - no transaction is active" errors. Fixed by synchronizing on the connection object. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0a2a0f2 commit 78e2ab8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/main/java/io/github/randomcodespace/iq/cache/AnalysisCache.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public boolean isCached(String contentHash) {
158158
*/
159159
public void storeResults(String contentHash, String filePath, String language,
160160
List<CodeNode> nodes, List<CodeEdge> edges) {
161+
synchronized (conn) {
161162
try {
162163
conn.setAutoCommit(false);
163164
String now = Instant.now().toString();
@@ -222,6 +223,7 @@ public void storeResults(String contentHash, String filePath, String language,
222223
} catch (SQLException ignored) {
223224
}
224225
}
226+
} // synchronized
225227
}
226228

227229
// --- Load cached results ---

0 commit comments

Comments
 (0)